Answer the question
In order to leave comments, you need to log in
Correct indication of the AND condition of a query in Mongo?
Hello. I'm trying Mongo and ran into a problem using the AND operator. For training, I use the dataset at the link .
I'm trying to find students by the condition:
students = db.find({"scores.score": {"$gt": 99.5}, "scores.type": "exam"})
{'_id': 69,
'name': 'Cody Strouth',
'scores': [{'score': 4.784730508547719, 'type': 'exam'},
{'score': 99.80348240553108, 'type': 'quiz'},
{'score': 97.89665889862901, 'type': 'homework'}]}
{'_id': 178,
'name': 'Whitley Fears',
'scores': [{'score': 20.84454374176408, 'type': 'exam'},
{'score': 57.14851257871499, 'type': 'quiz'},
{'score': 99.77237745070993, 'type': 'homework'}]}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question