match

open fun match(filter: FilterQuery<Document>.() -> Unit): Pipeline<Document>(source)

Filters documents based on a specified filter.

Matched documents are passed to the next pipeline stage.

Pipeline optimization

Place the match call as early in the pipeline as possible. Because match limits the total number of elements being processed, earlier match operations minimize the amount of processing down the pipe.

If you place a match at the very beginning of a pipeline, the query can take advantage of indexes.

External resources