Mongodb array $push and $pull

后端 未结 2 1427
生来不讨喜
生来不讨喜 2020-12-10 10:54

I was looking to pull some value from array and simultaneously trying to update it.

    userSchema.statics.experience = function (id,xper,delet,callback) {
          


        
2条回答
  •  囚心锁ツ
    2020-12-10 11:44

    I found this explanation:

    The issue is that MongoDB doesn’t allow multiple operations on the same property in the same update call. This means that the two operations must happen in two individually atomic operations.

    And you can read that posts:

    Pull and addtoset at the same time with mongo

    multiple mongo update operator in a single statement?

提交回复
热议问题