A confusion regarding $or operator

I’m trying to attempt final exam Question 6 which states

How many movies match the following criteria? - The cast includes either of the following actors: “Jack Nicholson”, “John Huston”. - The viewerRating is greater than 7. - The mpaaRating is “R”.

Which will eventually require the use of both $and and $or. I’ve summed up the following query but having problem in it. Can someone please tell me whats wrong with it.

db.video.find({ $and: [{ $or: [{ actors: “Jack Nicholson” }, { actors: “John Huston” }] }, { viewerRating: { $gt: 7 } }, { mpaaRating: “R” }] })

Also, how do I write in preformatted text format I mean if I have a block of code how do I write that in proper format. I tried indenting four space in the beginning of text but that didn’t work
Thanks in advance

Hey @Ahsan_72923

This is does not have to be the case.

The syntax is off. A .find() command has the follow inputs.

db.movies.find( <the query>, <the projection>) 

See these docs for more information.

To help you out the query will have a shape something like the following.

  field1: { $lt: 4 },
  field2: 'stringValue',

So this will find all doc with field1 less than 4 and with field2 equal to the string value.

Plus look at the available query operators to help you understand how to form the query based off the criteria given