Pritam
Pritam

Reputation: 1400

Azure doc db nested query

I have document schema like below in my collection

{
......
    Message :
    {
       Content : "E$XCV&*",
       Vehicles : [
         {
           Status : "",
           VehicleId : "veh1",
           ........
         },
         {
           Status : "",
           VehicleId : "veh2",
           ........
         },
         {
           Status : "",
           VehicleId : "veh1",
           ........
         },
         ............
       ]
    }
} 

I need to update status for particular vehicle id.

Upvotes: 0

Views: 78

Answers (1)

Jesse Carter
Jesse Carter

Reputation: 21147

CosmosDb doesn't have a convenient client side API for modifying a specific property of a document like this. You need to retrieve the document and make the modification and then use Upsert to put the newly updated document in it's place.

Alternatively, you can do it on the server side using CosmosDb Stored Procedures which would allow to modify the doc in place.

Upvotes: 1

Related Questions