View my Profile

Customize your Mongo cli, nice and easy

Here is a small tutorial about a code that I have written and that lies on my Github account. The idea is just to customize your Mongodb shell. This is particularly interesting if you (like me) almost perform the same requests just after launching the shell, or if you (like me) wish to rewrite the shell’s prompt.

Basically, what we are speaking about here is writing a mongorc file in Javascript, and use mongodb context to customize your shell. In this quick and simple example, at launch the shell will output the list of each collection for each database, and for every collection, it will output in a table format the number of documents. Besides, the prompt will be rewritten so that it will display the database you are playing with.

I hope that it will (like me) save you some time and work more efficiently.

You Might Also Like

Leave a reply