Mongo Db find and pretty explain.

The find() Method

To query data from MongoDB collection, you need to use MongoDB’s find() method.


The basic syntax of find() method is as follows −


find() method will display all the documents in a non-structured way.

The pretty() Method

To display the results in a formatted way, you can use pretty() method.




>db.mycol.find().pretty() { "_id": ObjectId(7df78ad8902c), "title": "MongoDB Overview", "description": "MongoDB is no sql database", "by": "tutorials point", "url": "", "tags": ["mongodb", "database", "NoSQL"], "likes": "100" } >

Apart from find() method, there is findOne() method, that returns only one document.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

Up ↑

%d bloggers like this: