Last Updated: February 25, 2016
·
2.489K
· leemachin

Pretty print MongoDB queries in REPL

Make your query more readable when using the REPL by chaining pretty() on to the end of it:

db.find({})
     .limit(10)
     .pretty()

Don't want to do it for every query? Enable it by default!

Just paste this into your terminal (not into the Mongo REPL):

echo "DBQuery.prototype._prettyShell = true" >> ~/.mongorc.js