Last Updated: February 25, 2016
·
516
· vitorleal

MongoLab config in nodejs

var mongo  = require('mongodb'),
    Server = mongo.Server,
    Db     = mongo.Db,
    server = new Server('ds1234.mongolab.com', 12345, { auto_reconnect : true }),
    db     = new Db('db-name', server);

db.open(function(err, client) {
    client.authenticate('username', 'password', function(err, success) {
        // Do Something ...
    });
});