Cosmos db api for problem with mongo db for some commands

I am using azure cosmosdb mongo api and cannot execute the bellow command. It works great when executed on a locally hosted mongo service. Is there any way to do this?

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

My details

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

I could reproduce the problem on my side when I perform the following update operation, this indicates that I have successfully updated the data.

enter image description here

But if I request data, I find that it is billForMonthnot being updated.

enter image description here

If I update a field without an array (e.g. a field location), it works fine.

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

, cosmos db: mongo api , . .

enter image description here

0

All Articles