What is the difference between the $match
operator used inside the aggregate function and the regular find
in Mongodb?
Why doesn\'t the
I investigated a few things about the aggregation and find call: I did this with a descending sort in a table of 160k documents and limited my output to a few documents.
ToList()
the aggregation command is faster than the find. Maybe the aggregation automatically calls the ToList()
and does not have to call it again. If you dont call ToList()
afterwards the find()
call will be much faster.
7 [ms] vs 50 [ms] (5 documents)