API某些命令面临问题

API某些命令面临问题

本文介绍了mongo db的cosmos db API某些命令面临问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用azure cosmosdb mongo api,并且无法在其上运行波纹管命令.在本地托管的mongo服务上执行时,它运行良好.有什么办法吗?

I am using azure cosmosdb mongo api and unable to run bellow command on it. It runs fine when executed on locally hosted mongo service. Is there any way around for this?

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
        }]
}

推荐答案

我可以重现此问题,当我执行以下更新操作时,表明我已经成功更新了数据.

I could reproduce the issue on my side, when I do the following update operatation, it indicates I have updated the data successfully.

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

But if I query the data, I find billForMonth is not updated.

如果我更新一个非数组字段(例如location字段),则可以正常工作.

If I update a non-array field (such as location field), it works fine.

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

似乎cosmos db:mongo api现在不支持 阵列更新 ,将来会支持此功能.您将在本文.

It seems that cosmos db:mongo api does not support Array Update now, this feature will be supported in future. You will find the following information in this article.

这篇关于mongo db的cosmos db API某些命令面临问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 18:46