The `count()` operation counts and returns the number of results that match a query. In MongoDB, you can use the `.count()` method with your `find()` query to get the number of documents that match the criteria.
Here are the basic forms of the `count()` operation:
```
// Counts all documents in a collection
db.collection.count()
// Counts documents in a collection that match a condition
db.collection.count(query)
// Counts documents using a condition and options
db.collection.count(query, options)
```
Replace `collection` with the name of your collection. Replace `query` with the condition you want to match. The `options` parameter is optional and allows you to include further options such as a limit or skip.
Here is an example that counts all documents in the `users` collection where the `age` is greater than 18:
```
db.users.count({ age: { $gt: 18 } });
```
The `$gt` operator is a comparison query operator that stands for ‘greater than’. In this case, it specifies a condition that the ‘age’ field must be greater than 18.
Keep in mind that as of MongoDB 4.0.3, the `count()` function is deprecated and it’s recommended to use `countDocuments()` for a full collection count or `estimatedDocumentCount()` for a fast count estimation.