Mongodb Select - MongoDB Tutorial

Mongodb Select

  • In mongoDB the data’s are displayed using the find().
  • Selects documents in a collection and returns a cursor to the selected documents.

Syntax :

db.collection.find(query, projection)  

Parameters Type Description
query document
  • Optional.
    Specifies selection filter using query operators. To return all documents in a collection, omit this parameter or pass an empty document ({}).
projection document
  • Optional. Specifies the fields to return in the documents that match the query filter.To return all fields in the matching documents, omit this parameter. For details, see Projection.

Sample Query :

{ "_id" : ObjectId("5731e045daa4a0bc932a2ff8"), "name" : "data" }
{ "_id" : ObjectId("5731e258daa4a0bc932a2ff9"),
                          "websitename" : "", 
                          "details" : "learn mongodb basics and step by step", 
                          "author" : "venkat" 
{ "_id" : ObjectId("5731e296daa4a0bc932a2ffa"), 
                         "websitename" : "",
                         "details" : "learn mongodb basics and step by step",
                         "author”: "venkat" 
{ "_id" : ObjectId("5731e2eadaa4a0bc932a2ffb"), 
                         "websitename" : "", 
                         "details" : "next row inserted", 
                         "articlecount" : "40", 
                         "author" : "jln" 
{ "_id" : ObjectId("5731e56ddaa4a0bc932a2ffc"), 
                             "websitename" : "", 
                             "rowdetails" : "last row updated", 
                             "author" : "arun", 
                             "comments" : [ { 
                                                         "user" : "john", 
                                                          "message" : "article is good", 
                                                         "place" : "new york" 
                                                    } ]



  1. Here in this statement, we display the data’s from the collection “wikitechy4” using the find() rich query.

Related Searches to Mongodb Select - MongoDB Tutorial

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add to your ad blocking whitelist or disable your adblocking software.