Created
January 20, 2016 05:11
-
-
Save alexhidalgo/2615773d4be7ad97abae to your computer and use it in GitHub Desktop.
This file contains hidden or 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
MongoClient.connect('mongodb://localhost:27017/test', function (err, db) { | |
var query = {'company_code': 'biotech'} | |
var cursor = db.collection('companies').find(query) | |
cursor.forEach( | |
function (doc) { | |
console.log(doc.name + ' is a company') | |
}, | |
function (err) { | |
assert.equal(err, null) | |
return db.close() | |
}) | |
}) | |
MongoClient.connect('mongodb://localhost:27017/test', function (err, db) { | |
var query = {'company_code': 'biotech'} | |
db.collection('companies').find(query).toArray(function (err, docs) { | |
docs.forEach(function (doc) { | |
console.log(doc.name + ' is a company') | |
}) | |
db.close() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment