What are some of the biggest mistakes people make in aggregation pipelines?

I find these most often:

  • Trying to use the operators from the MQL’s find, when aggregation operators need to be used.
  • Having too many stages - explains the logic, but inefficient.
  • Avoid using the $map, $reduce and $filter, when working with array fields.
  • Bad formatting of the query - not very readable (there can be some kind formatting rule! or even an Aggregation Query Formatter tool).
2 Likes