# Projection — MongoDB

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

> Choose which fields to return from a query.

## 1 to include, 0 to exclude

The second argument to `find()` is a **projection** — set a field to `1` to include it, `0` to exclude it.

## Projection example

`_id` is included by default — exclude it explicitly if you don't need it.

```javascript
db.users.find({ role: "engineer" }, { name: 1, role: 1, _id: 0 })
```

Output:

```
{ name: 'Grace Hopper', role: 'engineer' }
{ name: 'Barbara Liskov', role: 'engineer' }
```
