MongoDB TutorialLesson 7Free preview
MongoDB Find
This lesson is part of MongoDB · All levels
Summary
This lesson discusses data search with find() in mongosh. The first argument is a filter that determines which documents are appropriate, while the second argument is a projection to select the field to be displayed. The results can be refined with sort(), limit(), and countDocuments() to make the report more orderly.
Key points
- Without an argument return all the documents
- The first filter filters the document; the second projection selects the field that appears
- Return the first document that matches
- Sort(), limit(), and countDocuments() complete the search results
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.