Created
February 8, 2016 05:02
-
-
Save dineshsprabu/4701741380493fb76c53 to your computer and use it in GitHub Desktop.
Connecting to MongoDB using Monk from NodeJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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