About question 6

I couldn’t understand, why my result of query is incorrect?
db.movies.find({“cast”:{"$eq":“Jack Nicholson”,"$eq":“John Huston”}, “mpaaRating”:“R”, “viewerRating”:{$gt:7}}).count();
Result is one and this is incorrect.

I think that the following:

requires the $in operator with an array. Refer to https://docs.mongodb.com/manual/reference/operator/query/in/ for more information.

1 Like

Thank you very much!

I used the following query in compass but got no results:
{cast: {$in: [“Jack Nicholson, John Huston”]}, viewerRating: {$gt: 7}, mpaaRating: “R”}
what did I miss out on? Kindly advise.

Your quotes are wrong.

You want an array of 2 casts like "Jack Nicholson" , "John Huston" but you specified an array of 1 cast "Jack Nicholson, John Huston".

@steevej-1495 You’re damn right!
Thanks for saving me the headache.

Thanks @steevej-1495,

Hi @Lighthouse_59928,

If you have any other query then please feel free to get back to us.

Happy Learning :slight_smile:

Shubham Ranjan
Curriculum Support Engineer