小编Md *_*zri的帖子

MongooseError:查询已执行:Todo.updateOne({ _id: new ObjectId("612df063a8f

我将猫鼬更新到最新版本(6.0.2),现在我收到此错误并在.updateOne()执行时粉碎应用程序。但是数据库内部的对象更新。我的代码:

\n
async(req,res) => {\n    await Todo.updateOne(\n        {_id : req.params.id},\n        {\n            $set : {\n                status : "inactive"\n            }\n        },\n        (updateError) => {\n            // if updateError exist\n            if (updateError) {\n                // print error\n                printError(updateError);\n\n                // response the error\n                res.status(500).json({\n                    error : "There was a Server Side Error!"\n                });\n            } else {\n                // if error dose not exist\n                // print message\n                console.log("|===> \xef\xb8\x8f  Data Was Updated successfully! \xef\xb8\x8f <====|\\n");\n                // response success\n                res.json({\n                    message : "Todo Was Update successfully!"\n                });\n …
Run Code Online (Sandbox Code Playgroud)

javascript mongoose mongodb node.js express

7
推荐指数
2
解决办法
7255
查看次数

标签 统计

express ×1

javascript ×1

mongodb ×1

mongoose ×1

node.js ×1