【发布时间】:2019-04-17 06:49:50
【问题描述】:
在我的收藏中,只有一个文档。
> db.c20160712.find()
{ "_id" : ObjectId("57ab909791c3b3a393e9e277"), "Dimension_id" : 2, "Attribute" : "good", "Hour" : "20160712_06", "Frequency_count" : 100
我想运行updateOne 将文档替换为另一个文档。但是为什么会有Error: the update operation document must contain atomic operators呢?
> db.c20160712.updateOne( { "Attribute" : "good"}, {"Type" : "DVD", "Title" : "Matrix, The", "Released" : 1999, "Genre" : "Action"}, { upsert: true} )
2016-08-10T16:37:57.089-0400 E QUERY [thread1] Error: the update operation document must contain atomic operators :
DBCollection.prototype.updateOne@src/mongo/shell/crud_api.js:493:1
@(shell):1:1
上述命令中的第二个和第三个参数来自The Definitive Guide to MongoDB: A complete guide to dealing with Big Data ... By Eelco Plugge, David Hows, Peter Membrey, Tim Hawkins中的一个例子
我的 MongoDB 是 3.2。
【问题讨论】:
标签: mongodb