1.

Finding document

Answer»

The MongoDB shell provides the following methods to find documents:

S. No.CommandsDescription

1.

db.docx.findOne()Finds one random document.

2.

db.docx.find().prettyPrint()Finds all documents.

3.

db.docx.find({}, {name:true, _id:false})Displays only the names of the document Docx.

4.

db.docx.find({}, {name:true, _id:false})Can find one document by attribute among many documents.



Discussion

No Comment Found