.updateOne on MongoDB not working in Node.js

后端 未结 8 1036
迷失自我
迷失自我 2021-01-03 20:07

I have the following code:

connection((db) => {
            db.collection(\'orders\')
                .updateOne(
                    { \"_id\": req.body         


        
8条回答
  •  攒了一身酷
    2021-01-03 20:51

    This might happen if the collection schema is missing the field that is to be updated. If the schema is not strict (i.e, isStrict: false), check the update operator. In some cases, the new update value can be same as existing value. In this case, mongoose returns

    { n: 1, nModified: 0, ok: 1 }
    

提交回复
热议问题