Does the new Cosmos DB patch API gives us enough reasons to rethink about our designs?

Copper Contributor

One of the most emphasized rules I have learned from my experience when working with Cosmos DB is that, in your documents, you have to separate the parts which change very often from the parts which are rarely updated.

 

Like for instance, likes count in a post or comment. Whilst the posts content, title, author and tags are less likely to change after being set, it ok to put them together in a single document. But to include the post's likes count was not a good practice as every time the post get liked, shared or commented on, you had to update the whole document, which might not be ideal.

 

Edit: I just selected the SqlClient label because there's no Cosmos DB label and I wasn't able to post without a label. 🤷‍:male_sign:

1 Reply
I would say yes. For example, if you are providing a Web API on top of Cosmos DB, you can now directly implement support for the PATCH request method. Plus some performance and productivity improvements.

https://docs.microsoft.com/en-us/azure/cosmos-db/partial-document-update
https://github.com/AzureCosmosDB/PatchPrivatePreviewFeedbackGroup