Pretty Please

If you’re using MongoDB you’re most likely working daily with its shell.

Probably the first thing I learned about this interactive JavaScript interface was adding the pretty() method to all queries, to make it easier to read the results.

After few manual types, I decided to use pretty() by default.

To do so for a specific session:

(mongod-3.6.0) test> DBQuery.prototype._prettyShell = true

To enable it globally just add it to your $HOME/.mongorc.js:

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



For local development, I use Tyler Brock’s mongo-hacker.

I recommend trying it even if you’re only interested in UX enhancement (there are many more great features…).

$ npm install -g mongo-hacker

So Pretty

If you’re interested in changing the mongo shell batch size checkout my previous til.

comments powered by Disqus