0

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.

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

True.. Finally I came up with a stored proc.. Thanks to ARRAY_CONTAINS() of doc db.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.