.updateOne on MongoDB not working in Node.js

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

I have the following code:

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


        
8条回答
  •  佛祖请我去吃肉
    2021-01-03 20:40

    The correct syntax is:

    monDb.collection.updateOne(
        {"_id": ObjectID(req.params.id)}, 
        { $set: updateDoc }, 
        function(err, doc) {
          ...
        }
    );
    

提交回复
热议问题