Patch + Insert item (similar to Upsert) #2977
Unanswered
GopalanHarish
asked this question in
Q&A
Replies: 1 comment
-
I've been waiting for this feature for a long time. MongoDb had this 5 years ago and it was exceptionally useful when some properties were always safe to override. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is there a way to create a document if
PatchItemAsync()
fails with 404 Not Found? I am looking for something similar toUpsertItemAsync()
but for Patch operations.Currently, I do a
PatchItemAsync()
and if document does not exist it throws a 404 Not Found exception and then I do aCreateItemAsync()
for that item.Problem is I want to do a Bulk Insert using
AllowBulkExecution = true
and this is not a good approach.My other idea is to fetch all the document id's and conditionally create a
List<Task>
(for bulk) group forPatchItemAsync()
andCreateItemAsync()
. Not really happy with this but I don't see another way.Question, is there a better solution to handle such cases using SDK?
Beta Was this translation helpful? Give feedback.
All reactions