Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
Created May 12, 2013 05:56
Show Gist options
  • Save matthewpalmer/5562583 to your computer and use it in GitHub Desktop.
Save matthewpalmer/5562583 to your computer and use it in GitHub Desktop.
List all the items in a remote mongodb database
var MongoClient = require('mongodb').MongoClient;
function get(callback) {
MongoClient.connect('DBURL', function(err, db) {
var collection = db.collection('users');
var cursor = collection.find({});
cursor.each(function(a,b) {
console.log('response:', a, b);
});
});
}
get(function() {
console.log('hey');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment