How do I patch a large JSON document in Cosmos (something similar to T-SQL UPDATE) ?
See original GitHub issueIs your feature request related to a problem? Please describe. I have a Cosmos database with hundreds of documents and each document is over 2 KB. We have added a new application feature and as a result of which there is a need to update a certain fragment in the JSON or add a new fragment to the JSON.
Scenario 1- Update
In the following example, I would like to update the city
of all records from LDN to LONDON
{
"firstname":"John",
"lastname":"Doe",
"city":"LDN"
}
Scenario 2 - Add new fields
In the following example, I would like to insert the country
field to all records to GB and region
to 'WEST EUROPE`
{
"firstname":"John",
"lastname":"Doe",
"city":"LDN",
"country":"GB",
"region":"WEST EUROPE"
}
Describe the solution you’d like Something similar on the lines of T-SQL but relevant for JSON. E.g.
update Customers c where c.city="London" set "$.country="GB" , set "$.region="WEST EUROPE"
Describe alternatives you’ve considered I have had to write C# code on a case by case basis. In my code, I am having to deal with the JSON manipulation. This has become very burdensome when compared with how easy such a scenario would have been in the MSSQL world.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
What is the ETA for this feature being publicly available?
@ealsur, since #1616 is merged, do we now have patch support working? And if so… how does it work?