I'm now learning how to use MongoDB in Node.js, but as long as I know, there are two ways to write the code.
One (on some books and online blogs):
var Db = require('mongodb').Db, Connection = require('mongodb').Connection, Server = require('mongodb').Server;
Two (Github page and its documentation page on 10gen):
var MongoClient = require('mongodb').MongoClient;
Why does the disparity occur and which one should I take if there are any differences other than syntax? Perhaps it's due to different versions of the module, but if so on what number I have to take one over the other?
Thanks.
MongoClientis a recent addition to all the drivers and is now the generally preferred way to go.