MongoDB update with condition

前端 未结 6 678
鱼传尺愫
鱼传尺愫 2020-11-29 10:11

I\'m trying to update some field in my collection depending on a condition.

I want to set field active to true if the condition is tr

6条回答
  •  爱一瞬间的悲伤
    2020-11-29 10:31

    You can update MongoDB document conditionally using findAndModify() or findOneAndUpdate() if you have MongoDB version 3.2+

提交回复
热议问题