Skip to content Skip to sidebar Skip to footer

How To Correctly Query A Mongodb Nested Document With Python?

Background: I just learned the basics of databases and mongo this week. I have a collection named 'orderstest' of 10K documents with the following basic form: { '_id': {

Solution 1:

For "The 1st thing I need to do is to obtain all the documents whose ProductUId matches "A90" or "B90"."

.find({"OrderItems.ProductUId": {"$in":["A90","B90"]}})

Will work. Not sure why you're using $elemMatch, it doesn't seem necessary?

Post a Comment for "How To Correctly Query A Mongodb Nested Document With Python?"