.updateOne on MongoDB not working in Node.js

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

I have the following code:

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


        
8条回答
  •  囚心锁ツ
    2021-01-03 20:48

    For me, I have to delete the "_id"/id field before passing the object in the update.

    Or it will say that the field is invalid.

    Obviously, updated the key while you're using it as a reference isn't the best thing to do.

提交回复
热议问题