Created
January 31, 2013 22:48
-
-
Save blakmatrix/4687410 to your computer and use it in GitHub Desktop.
HOW TO USE MONGO ON NODEJITSU AND AUTHENTICATE AT THE SAME TIME!
This file contains 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
help: Connect with the `mongo` cli client: | |
help: | |
$ mongo linus.mongohq.com:10024/nodejitsudb1789005964 -u nodejitsu -p 026fb184f5d95f658fc147e54d560300 | |
help: | |
help: Connect with the `mongodb-native module`: | |
help: | |
var mongodb = require('mongodb'); | |
var db = new mongodb.Db('nodejitsudb1789005964', | |
new mongodb.Server('linus.mongohq.com', 10024, {}) | |
); | |
db.open(function (err, db_p) { | |
if (err) { throw err; } | |
db.authenticate('nodejitsu', '026fb184f5d95f658fc147e54d560300', function (err, replies) { | |
// You are now connected and authenticated. | |
}); | |
}); | |
help: | |
help: Connect with the `mongoose` module: | |
help: | |
var mongoose = require('mongoose'); | |
mongoose.connect('mongodb://nodejitsu:[email protected]:10024/nodejitsudb1789005964'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment