Skip to content

Instantly share code, notes, and snippets.

@dclucas
Created March 14, 2015 17:10
Show Gist options
  • Save dclucas/925501e03f5302318df8 to your computer and use it in GitHub Desktop.
Save dclucas/925501e03f5302318df8 to your computer and use it in GitHub Desktop.
var gulp = require('gulp');
gulp.task('mongo-eval', function() {
var Db = require('mongodb').Db,
Server = require('mongodb').Server,
assert = require('assert');
var db = new Db('local', new Server('localhost', 27017));
// Establish connection to db
db.open(function(err, db) {
if (err) {
console.log('error:' + err);
}
else {
db.eval('rs.conf()', function(err, result) {
if (err) {
console.log('error:' + err)
}
else {
console.log(result);
}
db.close();
});
}
});
});
@HemanthkumarHJ
Copy link

it is created a database in mongodb.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment