In MongoDB, you can use JSON-style objects such as in the following to query a collection:
db.things.find({ x : { $ne : 3 }, y : \'foo\' });
I\
Underscore.js is a great library to do map/reduce kind of jobs on javascript structures. Highly recommended.