Skip to content

Instantly share code, notes, and snippets.

@benzenwen
Forked from esedor/gist:1368293
Created August 8, 2012 18:17
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 benzenwen/3297233 to your computer and use it in GitHub Desktop.
Save benzenwen/3297233 to your computer and use it in GitHub Desktop.
Querying MongoDB in Node.JS
db.collection('quests', function(er, cl) {
cl.insert({'goal': 'Explore', 'lv': 1}, {safe: true}, function(er,rs) {
cl.update({'goal': 'Explore'},
{'$set': {'gold': 150}}, {safe: true}, function(er,rs) {
cl.find({'lv': {'$lte': 4}}).toArray(function (er,rs) {
console.log(rs);
}); }); }); });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment