Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get colorized query output and shell in MongoDB?

Tags:

It would be really nice to be able to view the output with colorized keys and values.

like image 883
Tyler Brock Avatar asked Dec 12 '12 14:12

Tyler Brock


People also ask

Where can I find MongoDB shell?

Find() Method. In MongoDB, find() method is used to select documents in a collection and return a cursor to the selected documents. Cursor means a pointer that points to a document, when we use find() method it returns a pointer on the selected documents and returns one by one.

How do I show all collections in MongoDB shell?

To list all collections in Mongo shell, you can use the function getCollectionNames().

How do I open a shell in MongoDB?

To open up the MongoDB shell, run the mongo command from your server prompt. By default, the mongo command opens a shell connected to a locally-installed MongoDB instance running on port 27017 . Try running the mongo command with no additional parameters: mongo.

What is pretty MongoDB?

The cursor. pretty() method is used to configure the cursor to display results in an easy-to-read format. Syntax: cursor.pretty() The pretty() method has the following prototype form: db.collection.find(<query>).pretty()


1 Answers

Check out this shell extension I made called Mongo-Hacker that has various enhancements:

  • Mongo Hacker Website
  • Code (GitHub)

Colorized MongoDB Shell

like image 195
Tyler Brock Avatar answered Sep 20 '22 17:09

Tyler Brock