Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
quick node.acs mongodb connection
var host="d5s029328.mongolab.com"; // replace with your MongoDB server address
var port="29328";// Replace with your MongoDB server port
var server_options=""
var mongodb = require("mongodb"),
mongoserver = new mongodb.Server(host, port),
db_connector = new mongodb.Db('|| ENTER MONGODB DB NAME ||', mongoserver,{w:0});
db_connector.open(function(err, myDB) {
if (!err) {
// work with database
console.log('connected');
} else {
// handle error
console.log('connection error');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.