M001 Chapter 4 Lab 2: Querying Arrays and Sub-Documents

There is problem in the database.

db.inspections.find({ “address.city”: “NEW YORK” }).count()
will be 18279 which is the correct answer for the lab.

but there is also another option:
db.inspections.find({“address.city”: “New York” }).count()
which will give you the result of 5.

This should not be happening in the lab as it is so misleading.

By default, MongoDB searches using case sensitivity, so unfortunately NEW YORKNew York.

There are ways of doing case insensitive queries, but that’s outside the scope of the course you’re taking.

1 Like