Skip to content

Instantly share code, notes, and snippets.

@3rd-Eden
Created January 6, 2011 07:33
Show Gist options
  • Save 3rd-Eden/767653 to your computer and use it in GitHub Desktop.
Save 3rd-Eden/767653 to your computer and use it in GitHub Desktop.
var mongo = require("mongodb");
var connection = new mongo.Db( "database-namehere", new mongo.Server( "the host of your db", "the port number" ) );
// open the connection
connection.open(function(err){
if( err ) console.error( err );
connection.authenticate( "user", "password", function( err ){
if( err ) console.error( err );
alert("working, authenticated connection")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment