findAndModify的一个更新

db.getCollection('cuishou_ids').findAndModify({
    'query':{
        'name':'user'
        },
      'update':{
          $set:{$inc:{'id':1}}
          },
       'new':true,
//        'upsert':true


    })


问题的原因是:

$set 和$inc不可以同时存在

Logo

欢迎加入DeepSeek 技术社区。在这里,你可以找到志同道合的朋友,共同探索AI技术的奥秘。

更多推荐