After entering through MongoDB's built-in shell, if you run db.coll_name.findOne(), you'll notice the returned data is nicely formatted and easy on the eyes. But if you switch it up and use db.coll_name.find() instead, you're instantly hit with a flood of unformatted data that's pretty much unreadable. Fortunately, it's easy to tweak the output to make it look much nicer.

There are two ways to do this.

The first is to append .pretty() to your query.

db.coll_name.find().skip(10).limit(3).pretty()
As shown above, we query the collection, skip 10 documents, limit the output to 3, and add pretty() at the end—the result is then displayed in a formatted way.

The other way is through a configuration file. Add the following line to $HOME/.mongorc.js:

JavaScript
DBQuery.prototype._prettyShell = true
When you start the MongoDB client, it will automatically load this content first, and from then on your find results will be automatically formatted.

Reference: