Error: the update operation document must contain atomic operators, when running updateOne

后端 未结 4 581
北恋
北恋 2020-12-05 03:41

In my collection, there is only one document.

> db.c20160712.find()
{ \"_id\" : ObjectId(\"57ab909791c3b3a393e9e277\"), \"Dimension_id\" : 2, \"Attribute\         


        
4条回答
  •  情话喂你
    2020-12-05 04:26

    Wrong syntax for the second parameter. Please check the docs. It should be:

    db.c20160712.updateOne(
        { "Attribute" : "good" }, 
        { $set: {"Type" : "DVD", "Title" : "Matrix, The", "Released" : 1999, "Genre" : "Action" } },
        { upsert: true }
    );
    

提交回复
热议问题