Lab 2.5: Queries on Array Fields, Part 2

While working on Lab 2.5 I was unable to get correct data for my query in mongo shell
db.movieDetails.find({“genres.1”: “Western”}).count()
I got result: 0
And in Compass {genres.1: “Western”} I was not able to filter due to Filter showing in Red

Hi @Yelena_Demura_39178,

With the current versions of Compass, whenever the . operator is used on a key to indicate a child key such as “imdb.rating” or when using the . operator to use a positional query such as “genres.1”, the key must be surrounded in quotes.

Hope it helps :slight_smile:

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

Shubham Ranjan
Curriculum Support Engineer

@Shubham_Ranjan, thank you for the reply. I got {“genres.1”: ‘Western’} working in Compass.

What about the mongo shell? I am getting 0 to the db.movieDetails.find({“genres.1”: “Western”}).count()