Why does the order of statement matters in logical operators?

While working on Chapter4 lab1: Logic Operators I see that

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

and

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

has different result. Why is it so?

Thanks,
Sandeep

The second statements do need the MQL operator,

  • For the first one "lt => $lt
  • For the second one gt => $gt
2 Likes

Thank you :slight_smile: My mistake. I missed the $ sign. Its returning me same result.