Wrong answer is being accepted as correct

I completed the last “Quiz: Querying Arrays and Sub-documents” under Chapter 4: Advanced CRUD Operations and the wrong answer (option 2) was accepted as the correct answer. According to my understanding option,1 is the correct answer, and when I checked the answer the correct answer is option 1.

Hi @Mubashir_Waheed, welcome to the community :wave: .
That’s interesting, can you please share a screenshot of the same?

If you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
MongoDB

Here is the screenshot

The correct syntax is amenities.0 and that is the one you selected and that was marked as correct. And the explications indicates that the version with amenities.0 is correct.

For the version with amenities.$0 it is indicated that

This is incorrect .

There is no need to add a $ before stating the element position in this case.

And for the version with amenities.[0] it is indicated that

This is incorrect .

Similarly, there is no need for square brackets around the position of the array element

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.