In the lecture about query operator - logic, Instructor says following are same but looks like 2nd option does not and throw errors.
-
db.grades.find({"$and": [{"student_id": {"$gt": 25}}, {"student_id": {"$lt": 100}}]}).count()
-
db.grades.find({"student_id": {"$gt": 25}}, {"student_id": {"$lt": 100}})
-
db.grades.find({"student_id": {"$gt": 25, "$lt": 100}})
When running the 2nd query throwing error.
db.grades.find({"student_id": {"$gt": 25}}, {"student_id": {"$lt": 100}})
Error: error: { "ok" : 0, "errmsg" : "Unsupported projection option: student_id: { $lt: 100.0 }", "code" : 2, "codeName" : "BadValue" }
Thanks