# deleteOne & deleteMany — MongoDB

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

> Remove documents that match a filter.

## deleteOne()

Removes the first document matching the filter.

```javascript
db.users.deleteOne({ name: "Alan Turing" })
```

Output:

```
{ acknowledged: true, deletedCount: 1 }
```

## deleteMany()

Removes every document matching the filter.

```javascript
db.users.deleteMany({ role: "intern" })
```

Output:

```
{ acknowledged: true, deletedCount: 3 }
```

## Careful with an empty filter

`deleteMany({})` removes **every** document in the collection — always double-check the filter before running it.
