Why cant below be answer of above problem.
{$and : [{results:{$elemMatch:{$gte:70}}},{results:{$elemMatch:{$lt:80}}}]}
Why cant below be answer of above problem.
{$and : [{results:{$elemMatch:{$gte:70}}},{results:{$elemMatch:{$lt:80}}}]}
because { results : [ 69 , 80 ] }
Hi @Pratiyush_Singh,
Please review the syntax of elemMatch operator.
Your query is basically equivalent to this :
{$and : [ {results:{$gte:70}} , {results:{$lt:80}} ]}
I don’t think this is what you want to do here. Please go through the documentation and let me know if you are still having any questions.
~ Shubham