The `$exists` operator in MongoDB is used to check if a specified field exists or not in a document. This operator returns the documents that contain the field, including documents where the field value is null.
If the value is `true`, then the query would return the documents where the field exists, regardless if the field does not contain a value or contains a value of `null`. If the value is `false`, then the query returns only the documents where the field does not exist.
Here how to use `$exists` operator:
Syntax
```
{ field: { $exists:
```
Example
```
db.collection.find( {
```
This will find documents in the “collection” where `
For example, if you have a collection named `students` and you want to find all documents that contain a field named `address`, you would write it like this:
```
db.students.find( { address: { $exists: true } } )
```
And if you want to find all documents that do not contain the field `address`, you would write it like this:
```
db.students.find( { address: { $exists: false } } )
```