[英]Mongo db update query is not working in embedded documents in azure cosmos db
Embedded Update query works fine in mlab and atlas but not working in Cosmos DB:嵌入式更新查询在 mlab 和 atlas 中工作正常,但在 Cosmos DB 中不起作用:
My Collection structure:我的收藏结构:
{
"_id" : ObjectId("5982f3f97729be2cce108785"),
"password" : "$2y$10$F2P9ITmyKNebpoDaQ1ed4OxxMZSKmKFD9ipiU1klqio239c/nJcme",
"nin" : "123",
"login_status" : 1,
"updated_at" : ISODate("2017-05-16T09:09:03.000Z"),
"created_at" : ISODate("2017-05-16T06:08:47.000Z"),
"files" : [
{
"name" : "abc",
"updated_at" : ISODate("2017-05-16T06:08:48.000Z"),
"created_at" : ISODate("2017-05-16T06:08:48.000Z"),
"_id" : ObjectId("5982f3f97729be2cce108784")
}
],
"name" : "demo",
"email" : "email@gmail.com",
"phone" : "1231234",
}
My query is:我的查询是:
db.rail_zones.update(
{'_id': ObjectId("5982f3f97729be2cce108785"),
'files._id' : ObjectId("5982f3f97729be2cce108784")},
{ $set: {'files.$.name' : "Changed"}})
I get this response:我得到这个回应:
"acknowledged" : true,
"matchedCount" : 0.0,
"modifiedCount" : 0.0
According to your description, I tested this issue on my side and found the Array Update could not work as expected.根据您的描述,我在我这边测试了这个问题,发现阵列更新无法按预期工作。 I assumed that the Array Update feature has not been implemented in the MongoDB Compatibility layer of Azure CosmosDB.
我假设 Azure CosmosDB 的 MongoDB 兼容层中尚未实现阵列更新功能。 Moreover, I found a feedback Positional array update via '$' query support talking about the similar issue.
此外,我通过 '$' 查询支持找到了一个关于类似问题的反馈位置数组更新。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.