Reading Documents: Array Fields - [js] SyntaxError: missing : after property id @(shell):1:28

Lab 2.5: Queries on Array Fields, Part 2

How many movies in the movieDetails collection list “Western” second among its genres?

Trying to solve this answer. I did the next query


and receive this error
[js] SyntaxError: missing : after property id @(shell):1:28

It is the same query on the video
{cast.0: “Jeff Bridges”}
Looking for the actor Jeff Bridges in the first position of the array

Hi Javier_95710,

If we are using nested key, then we have to enclose the key in double quotes like:

{"cast.1": "Jeff Bridges"}

For more information, then please check Query for an Element by the Array Index Position.

Hope it helps!

Thanks, Kanika


Lesson 2.7 time 4:01
Quotes to the query should be added as it may mislead.

Thanks for the note @Artur_99485, I will make sure it is added as a Lecture Note.

Thanks for the catch! :slight_smile: