cosmos db api for mongo db面临一些命令的问题

时间:2017-06-19 14:56:34

标签: mongodb azure-cosmosdb

我正在使用azure cosmosdb mongo api,无法在其上运行bellow命令。在本地托管的mongo服务上执行时运行正常。对此有什么办法吗?

db.getCollection('requests').update(
 {claims: { $elemMatch: { id:1000 }}},
 {$set:{"claims.$.billForMonth":"1"}}
)

我的数据是

{
    "_id" : NumberLong(1000),
    "location" : "pune",
    "claims" : [ 
        {
            "id" : NumberLong(1000),
            "type" : "broadband",
            "billForMonth" : 4
        }]
}

1 个答案:

答案 0 :(得分:1)

我可以在我这边重现这个问题,当我进行以下更新操作时,它表示我已成功更新数据。

enter image description here

但如果我查询数据,我发现billForMonth未更新。

enter image description here

如果我更新非数组字段(例如location字段),它可以正常工作。

db.testc1.update(
 {claims: { $elemMatch: { id:1000 }}},
 {$set:{"location":"pune1"}}
)

似乎cosmos db:mongo api现在不支持 阵列更新 ,将来会支持此功能。您可以在this article中找到以下信息。

enter image description here

相关问题