$match

noun

say it: “DOL-er MACH” /ˈdɑlər ˈmætʃ/

A MongoDB aggregation stage that keeps only the documents matching a filter, written like a find filter.

What does $match do?

$match is the aggregation stage that filters documents, using the same syntax as find. Put it early so later stages have less work.

In a sentence

  • “The pipeline starts with $match, so only this year's orders are grouped.”
  • “Putting $match first lets the pipeline use an index.”

Level: Journeyman · More MongoDB terms at this level

Updated