Dot notation vs. $elemMatch

前端 未结 1 1517
孤城傲影
孤城傲影 2021-01-18 13:26

I have a unitScores collection, where each document has an id and an array of documents like this:

\"_id\": ObjectId(\"52134edd5b1c2bb503000001\"),
\"scores\         


        
相关标签:
1条回答
  • 2021-01-18 13:49

    $elemMatch is not the same logic as dot notation. $elemMatch requires the same nested elements to have the values. Using dot notation allows for any nested elements to have an values. Thus, your seeing different results because the query logic is different.

    0 讨论(0)
提交回复
热议问题