I am working on Azure Cosmos DB with SQL Api. I am using Azure SDK from:
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-documentdb</artifactId>
<version>2.4.7</version>
</dependency>
in order to delete an Item (document) from collection, I am using:
String documentLink = collectionLink + "/docs/" + documentId;
RequestOptions options = new RequestOptions();
options.setPartitionKey(new PartitionKey(String.valueOf(documentId)));
documentClient.deleteDocument(documentLink, options);
When the desired document exists, then this code works perfectly fine. When the document with documentId does not exist then I am getting an Exception:
com.microsoft.azure.documentdb.DocumentClientException: Entity with the specified id does not exist in the system.
Is there any way to delete documents "silently" - meaning no Exception will be thrown when document does not exist?