Lesson 6 / 22
find() Basics
Fetch documents with find() and findOne().
find() everything
An empty filter {} matches every document in the collection.
db.users.find({})Filtering & findOne()
Pass a filter document to match specific fields. findOne() returns just the first match.
db.users.find({ role: "engineer" })
db.users.findOne({ name: "Grace Hopper" })pretty() for readability
In the shell, chain .pretty() after find() to format long results as indented JSON.