Hi Everyone,
I hope you enjoyed our course so far! You might have noticed one challenge problem.
If you have ended up with a solution like this:
> { results: { $gte: 70, $lt: 80 } }
Output would be 1020 documents. But that is not a correct answer. You must be wondering why? Here is one sample document from the above query:
Now, this doesn’t seem right. The query { results: { $gte: 70, $lt: 80 } } would have worked fine if results was a single field and not an array. For arrays, if you want to match all the specified query criteria, you would want to use elemMatch operator.
For more explanation, I would like you to explore elemMatch MongoDB documentation.
Hope it helps!
Kanika