Chapter 4 Lab 2: Querying Arrays and Sub-Documents - wrong answer?

I tried the suggestion of reloading the sample database, but the following query still comes back with the wrong answer of 18279 (which was marked wrong for my entry, however after I failed it did show this as the correct answer?)

db.inspections.find({ "address.city": "NEW YORK" 
}).count()

Trying it with the regex, it comes back with another wrong answer of 18303…

db.inspections.find({ "address.city": {"$regex": "NEW YORK" }
}).count()

With proper casing, it comes back with 5:

db.inspections.find({ "address.city": "New York" 
}).count()

adding 5 to 18279 gives 18284 (which also was marked wrong by the engine…)

What gives? (I missed the credit on this one myself, unfortunately)

Hi @Brent_Stevenson,

We are sorry for the inconvenience you faced during solving the Lab question.
We always encourage learners to do their best.
So, we have given the credit for this Lab. :sparkles:

And, we wish you Good Luck with the rest of the course. :slight_smile:
Let us know if you have any additional questions.!!

Kind Regards,
Kushagra

1 Like

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