宇宙db api mongo db面临一些命令的问题

宇宙db api mongo db面临一些命令的问题

问题描述:

我正在使用azure cosmosdb mongo api并且无法运行波纹管命令。在本地托管的mongo服务上执行时,它运行良好。有没有办法解决这个问题?宇宙db api mongo db面临一些命令的问题

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

[cosmosdb蒙戈API不工作的一些命令]的可能的复制(https://*.com/questions/44587440/cosmosdb-mongo-api-not-working-for-some-commands) –

+0

该链接是关于一个不同的命令,我无法找到替代这个特定的更新命令 – Shantanu

我可以重现我这边的问题,当我做了以下更新operatation,表示我已经将数据成功更新。

enter image description here

但是,如果我查询到的数据,我发现billForMonth没有更新。

enter image description here

如果我更新非阵列字段(如location字段),它工作正常。

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

看来,宇宙DB:Mongo的API不支持阵列更新现在,这一功能将在未来支持。您将在this article中找到以下信息。

enter image description here