Created
November 8, 2012 18:23
-
-
Save cronopio/4040571 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
// | |
// Lets take as example the next Mongodb URI | |
// mongodb://nodejitsu:[email protected]:10047/nodejitsudb54463349176 | |
// mongodb://username:passwd@hostname:port/datababaseName | |
// | |
// So the code should looks like | |
var mongodb = require('mongodb'); | |
var db = new mongodb.Db('nodejitsudb544633491762', | |
new mongodb.Server('alex.mongohq.com', 10047, {}) | |
); | |
db.open(function (err, db_p) { | |
if (err) { throw err; } | |
db.authenticate('nodejitsu', '684e3def50116af8c8ab032f65230fac', function (err, replies) { | |
// You are now connected and authenticated. | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment