Skip to content

Instantly share code, notes, and snippets.

@dvv
Created October 24, 2010 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvv/643545 to your computer and use it in GitHub Desktop.
Save dvv/643545 to your computer and use it in GitHub Desktop.
/*
package.json contains
"mongodb": "jar:http://github.com/christkv/node-mongodb-native/zipball/master!/lib/mongodb/",
*/
var Cursor, DB, DBServer, client, server;
DB = require('mongodb/db').Db;
DBServer = require('mongodb/connection').Server;
Cursor = require('mongodb/cursor').Cursor;
Cursor.prototype.formattedOrderClause = function() {
return this.sortValue;
};
server = new DBServer('127.0.0.1', 27017, {});
client = new DB('omega', server, {native_parser: true});
client.open(function(err, db) {
console.log('MONGO CLIENT OK');
return db.collection('Log', function(err, collection) {
console.log(new Date());
return collection.find({}, {
limit: 1
}, function(err, cursor) {
return cursor.toArray(function(err, items) {
console.log('ITEMS', items.length);
return console.log(new Date());
});
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment