MongoDB update multiple subdocuments with or query

前端 未结 5 910
时光取名叫无心
时光取名叫无心 2021-01-27 14:50

I want to make an update query for multiple subdocuments at once. I will be setting all the subdocuments statuses to passive where they satisfy the condition I give on query. <

5条回答
  •  半阙折子戏
    2021-01-27 15:41

    Not so sure about what do you want, but if I were right, what you want may be $elemMatch.

    Refer to MongoDB Update Manual , and $elemMatch

    When you wanna query into embedded documents, you can't use $and and $or directly, this is some kind of 'bug' of mongodb.

提交回复
热议问题