You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there a way to create a document if PatchItemAsync() fails with 404 Not Found? I am looking for something similar to UpsertItemAsync() 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 a CreateItemAsync() 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 for PatchItemAsync() and CreateItemAsync(). Not really happy with this but I don't see another way.
Question, is there a better solution to handle such cases using SDK?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
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