Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (47.6k points)

Is there a way to tell Mongo to pretty print output? Currently, everything is output to a single line and it's difficult to read, especially with nested arrays and documents.

2 Answers

0 votes
by (106k points)

You can use the pretty() function for pretty print in MongoDB shell as default see the code below:-

db.collection.find().pretty()

0 votes
by (107k points)

In MongoDB, a function exists known as pretty function. It will display all the documents in separate lines, refer to the following screenshot:

image

Here 'operate' is my collection name.

Related questions

0 votes
1 answer
0 votes
2 answers
0 votes
2 answers
asked Oct 16, 2019 in Web Technology by Sammy (47.6k points)

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...