Skip to content

Instantly share code, notes, and snippets.

@rentalcustard
Created October 24, 2011 13:26
Show Gist options
  • Save rentalcustard/1309020 to your computer and use it in GitHub Desktop.
Save rentalcustard/1309020 to your computer and use it in GitHub Desktop.
Web development in 2011. Apparently.
//from https://github.com/christkv/node-mongodb-native
var p_client = new Db('integration_tests_20', new Server("127.0.0.1", 27017, {}), {'pk':CustomPKFactory});
p_client.open(function(err, p_client) {
p_client.dropDatabase(function(err, done) {
p_client.createCollection('test_custom_key', function(err, collection) {
collection.insert({'a':1}, function(err, docs) {
collection.find({'_id':new ObjectID("aaaaaaaaaaaa")}, function(err, cursor) {
cursor.toArray(function(err, items) {
test.assertEquals(1, items.length);
// Let's close the db
p_client.close();
});
});
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment