So, in this lab we are required to find all documents where the pop
field is more than 1,000,000 and less than 5,000 in the sample_training.zips
dataset.
Following are the two queries mentioned in the detailed answer for this lab.

db.zips.find({ "pop": { "$gt": 5000, "$lt": 1000000 }}).count()

db.zips.find({ "$nor": [ { "pop": { "$lt":5000 } }, { "pop": { "$gt": 1000000 } } ] } ).count()
But both queries are not equivalent, the first query checks if the population is greater than 5,000 and less than 1,000,000. Therefore it doesn’t include documents where population is equal to 5,000 or 1,000,000. So, it excludes the endpoints.
The second query on the other hand checks if the population is neither less than 5,000 nor greater than 1,000,000, which means the population is greater than equal to 5,000 and less than equal to 1,000,000. So, it includes the endpoints.
But if we test these queries the results would turn out to be identical because there’s no data where the population is equal to either 5,000 or 1,000,000, which can be verified using this query
{$or: [{pop: 5000}, {pop: 1000000}]}
.
So, if we add a datapoint where the pop
field equal to either 5,000 or 1,000,000 we would see a difference in counts returned.
Screenshot from the course.