MongoDB Select Query Document-Programmershelper



MongoDB Select Query

This article will provide step by step basic concept of MongoDB.where you can easily understand the core concept of MongoDB.In a MongoDB<db.Collection.find()>method is used to return all document form collection.this method works same like select query in a relational will find a single document and also find all document from the collection in pretty formate or non-structure.


It would be better if you have the basic knowledge of RDBMS concept. Actually, you are going to learn a high-performance database so we need some basics of these.You should also read my previous articles.In which I explained.MongoDB inserts document step by step Detail and How can create a Database in MongoDB.

Implementation Section

  • Find method().
  • The find pretty Method().
  • FindOne Method().

Find method()

To select all document from the database the find method is used.find method returns all the documents.the document shown in find method () is non-structure.

The following is basic Syntax-


The following data is not a formatted way.To overcome this problem we will use a pretty method.

Alt tag MongoDB select query

The find pretty method ()

Using find pretty method().All the result are showing a formatted way. I will show you a simple example with syntax.

The following basic Syntax-

The following data will display in a formatted way

Using Pretty method everything is displayed in the document.


Alt tag MongoDB select query

FindOne Method()

As the name implies FindOne method returns a single document.if you want to select a single document out of the whole then find one method() is used.

 The following is basic Syntax

you can try this

So searching the whole collection and return one document.


Alt tag MongDB insert query


I wish I could tell you that a great site of just understands key element above post-MongoDB select query working.Click here More Detail about how can find method work. I hope you will understand this lecture.Thank you for reading this lecture. Hope you got the idea. please share it.