# find() Basics — MongoDB

Source: https://www.geekswithgeeks.com/en/mongodb/mongo-find-basics

> Fetch documents with find() and findOne().

## find() everything

An empty filter `{}` matches every document in the collection.

```javascript
db.users.find({})
```

## Filtering & findOne()

Pass a filter document to match specific fields. `findOne()` returns just the first match.

```javascript
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.
