# find() Basics — MongoDB Fundamentals: Documents, Queries and Indexes

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

> Fetch documents with find and findOne using empty and field-based filters.

## 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

`mongosh` prints results as formatted, readable JSON by default. In the older `mongo` shell, chain `.pretty()` after `find()`.
