我正在用MongoDB做一个简单的updateMany。我使用的是Studio3T。下面是我的问题:
db.getCollection("FineMapping").updateMany( {}, { $rename: { "algorith": "method" } } )
这是对集合中所有文档的属性的简单重命名。Studio3T中的响应是:
{
"acknowledged" : true,
"matchedCount" : 7176215.0,
"modifiedCount" : 0.0
}因此所有文档都匹配,但没有实际修改过的文档。为什么文档实际上没有被修改?
发布于 2020-08-26 08:06:01
最可能的原因是它们都没有名为algorith的字段。
请参阅https://docs.mongodb.com/manual/reference/operator/update/rename/index.html#behavior上的文档
发布于 2020-08-26 17:55:49
您还可以右键单击批量编辑多个或所有文档,而不是使用IntelliShell:https://studio3t.com/knowledge-base/articles/mongodb-documents-beginners-guide/#update-multiple-documents-e-g-matching-the-query-criteria-all-documents
https://stackoverflow.com/questions/63587235
复制相似问题