M001: Chapter 4: Array Operators and Projections

Using Atlas, the provided example query does not produce the desired/expected output:

{ “class_id”: 431 },
{ “scores”: { “$elemMatch”: { “score”: { “$gt”: 85 } } }
}

Instead of results where a score of 85 or more was present, I got this:

https://imgur.com/Q7AfyoP

The closing brace after 431 closes the query. So scores is not really part of the query.

You have to remove the closing brace after 431 and the opening brace before scores.

2 Likes

Thank you. That correction worked for me.