Are there any differences (besides method 1 being async) between method 1 and 2 to obtain a reference to a mongodb collection shown below?
var mongo = require('mongodb');
var db= new mongo.Db('blog', new mongo.Server(host, port, {auto_reconnect: true}, {}));
db.open(function(){
//Method 1
db.collection('articles', function(err, result){
var collection1 = result;
});
//Method 2
var collection2 = new mongo.Collection(db, 'articles');
});
I have only done it the "Method 1" way -- which works like a dream! (And, like you said, is async -- which is a must)