Skip to content

Instantly share code, notes, and snippets.

@dineshsprabu
Created February 8, 2016 05:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dineshsprabu/4701741380493fb76c53 to your computer and use it in GitHub Desktop.
Save dineshsprabu/4701741380493fb76c53 to your computer and use it in GitHub Desktop.
Connecting to MongoDB using Monk from NodeJS
var mongo = require('mongodb');
var monk = require('monk');
var db_name = ''
var db = monk('localhost:27017/'+db_name);
var collection = db.get('collection_name');
collection.find({}, function(err,docs){
console.log(docs);
db.close();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment