As I read through the doc on $match, it says that we can use aggregation expression in $match, but not in raw form. But the quiz say it’s wrong that
match can use both query operators and aggregation expressions
What are your opinions?
As I read through the doc on $match, it says that we can use aggregation expression in $match, but not in raw form. But the quiz say it’s wrong that
match can use both query operators and aggregation expressions
What are your opinions?
Hey @Ann_90310
Because of the following, specifically that last sentence.
$match
takes a document that specifies the query conditions. The query syntax is identical to the read operation query syntax; i.e.$match
does not accept raw aggregation expressions. Instead, use a$expr
query expression to include aggregation expression in$match
.
$match
can, if you use $expr
, take aggregation expressions.
This is even a common bit of confusion among students.