Skip to content

Instantly share code, notes, and snippets.

@esedor
Created November 15, 2011 20:47
Show Gist options
  • Save esedor/1368293 to your computer and use it in GitHub Desktop.
Save esedor/1368293 to your computer and use it in GitHub Desktop.
Querying MongoDB in Node.JS
mongoose.connection.db.collection('quests', function(err, coll) {
coll.insert({'goal': 'Explore a new land', 'level': 1});
coll.update({'goal': 'Explore a new land'},
{'$set': {'reward.gold': 150}});
coll.find({'level': {'$lte': 4}}).toArray(function (err, result) {
console.log(result);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment