Mongo DB更新查询不适用于Azure Cosmos DB中的嵌入式文档 [英] Mongo db update query is not working in embedded documents in azure cosmos db

查看:55
本文介绍了Mongo DB更新查询不适用于Azure Cosmos DB中的嵌入式文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嵌入式更新查询在mlab和Atlas中工作正常,但在Cosmos DB中不起作用:

Embedded Update query works fine in mlab and atlas but not working in Cosmos DB:

我的收藏集结构:

{
    "_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",

}

我的查询是:

db.rail_zones.update(
  {'_id': ObjectId("5982f3f97729be2cce108785"),
   'files._id' : ObjectId("5982f3f97729be2cce108784")},
  { $set: {'files.$.name' : "Changed"}})

我收到以下答复:

"acknowledged" : true,
"matchedCount" : 0.0,
"modifiedCount" : 0.0

推荐答案

根据您的描述,我从侧面测试了此问题,发现阵列更新"无法按预期工作.我假设阵列更新功能尚未在Azure CosmosDB的MongoDB兼容性层中实现.此外,我发现了一个反馈,讨论了类似的问题.

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. Moreover, I found a feedback Positional array update via '$' query support talking about the similar issue.

这篇关于Mongo DB更新查询不适用于Azure Cosmos DB中的嵌入式文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆