New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cosmos DB: Adds Patch Support #2161
Conversation
053dbdb
to
8932d9f
Compare
/azp run |
8932d9f
to
df297ab
Compare
/azp run |
3 similar comments
/azp run |
/azp run |
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on clarification on the need to introduce a patch
permission..
985c8bb
to
4b85e65
Compare
/azp run |
1 similar comment
/azp run |
cea72a8
to
8233fdd
Compare
/azp run |
/azp run |
/azp run |
Co-authored-by: Aniruddh Munde <anmunde@microsoft.com>
previous comments have been addressed, but I need more time to look at few other files.. so reset my review. If this gets approved before that, feel free to merge it in. |
/azp run |
/azp run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/azp run |
Why make this change?
Today, in cosmos DB, we have ability to
update
the item which is actuallyreplace
the item. Adding new operation i.e.patch
where customer would have ability to "patch" an item.PATCH
would be available only for Cosmos DB.What is this change?
Before going further, it is highly recommended to go through below docs:
To Summarize, here is a simple example of patch:
You need to generate
PatchOpertation
which need below information:a) Operation type i.e. Set, Add, Remove etc
b) Attribute Path where operation needs to be applied i.e "/color", "/used" in above example
c) New value
What DAB supports?
Set
operation, as it solves the purpose to update an item. It means, you cannot perform any specific operations like remove, move etc.Changes as part of this PR:
patch
operation for given entitiesPatchPlanetInput
without id field as using patch operation you can not update anId
a) It translates the passed item into "patchoperation" by traversing the item.
b) Checks if number of patch operations are less than 10 or more than 10 (as cosmsodb supports at max 10 patch operations at a time)
c) If it is less than or equal to 10, it fires patch call with patch operations
d) If it is greater than 10, then it creates a transaction batch of patch call, with 10 patch operations in each patch call. (RU exhaustive but functionally it works)
Pictorial Overview of the implementation
Authorization for this new Mutation Operation:
update
access would be applied forpatch
andupdate
operations both.How was this tested?
Sample Request(s)
Refer test cases.