MongoDB Shell Enhancements for Hackers
It's easy, just clone the repo and run make
.
$ git clone git@github.com:TylerBrock/mongo-hacker.git
$ cd mongo-hacker
$ make
db.collection.filter() -- accepts less parameters than find, simply matches
db.collection.filter({ ... }).one() # equivalent to db.collection.findOne({ ... })
db.collection.filter({ ... }).select({ name: 1 }) # only returns the name and _id fields
db.collection.filter({ ... }).update({ ... }) # multi update
db.collection.filter({ ... }).replace({ ... }) # single replacement
db.collection.filter({ ... }).upsert({ ... }) # single upsert
db.collection.filter({ ... }).remove() # multi remove
db.collection.filter({ ... }).limit(7).update({ ... })
db.collection.filter({ ... }).sort({ ... }).skip(1).limit(3).update({ ... })
db.collection.filter({ ... }).limit(3).remove()
gcount(group_field, filter)
gsum(group_field, sum_field, filter)
gavg(group_field, avg_field, filter)
Print index usage information on every query (default false)
Highlights slow running queries
Originally created and conceived of by Tyler Brock (@TylerBrock) and Mike O'Brien (@mpobrien) who work as Software Engineers at 10gen (@10gen) in New York City. Despite being a young project, there have already been many other contributors as we encourage pull requests and criticism. Thank you to everyone who has used or contributed to Mongo Hacker.
This software comes with no guarantee or warranty and is not endorsed by 10gen in any way.