Skip to content

Instantly share code, notes, and snippets.

@glenjamin
Forked from Orion98MC/gist:1188180
Created September 2, 2011 08:46
Show Gist options
  • Save glenjamin/1188205 to your computer and use it in GitHub Desktop.
Save glenjamin/1188205 to your computer and use it in GitHub Desktop.
var Db = require('mongodb').Db,
Connection = require('mongodb').Connection,
Server = require('mongodb').Server;
var db = new Db('mongo-test', new Server("localhost", Connection.DEFAULT_PORT, {}), {native_parser:false});
var context = this;
var onConnect = function(err, db) {
db.dropDatabase(function() {
db.collection("foo", function(err, coll) {
context.collection = coll;
console.log("foo collection set");
});
});
};
db.open(onConnect);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment