To delete a document that has a PK set as a value
options.setPartitionKey(new PartitionKey(pkValue));
client.deleteDocument(doc.getSelfLink(), options);
However, for documents for which PK is not set
options.setPartitionKey(null);
client.deleteDocument(doc.getSelfLink(), options);
Or
client.deleteDocument(doc.getSelfLink(), null);
Why when I try to delete it like
PartitionKey value must be supplied for this operation.
Error is returned.
To avoid this
// com.microsoft.azure.documentdb.Undefined
options.setPartitionKey(new PartitionKey(Undefined.Value()));
It seems that it is a specification that must be done. The same is true not only in Java but also in other languages.
(Since the value doesn't exist in the first place, I'd like it to be passed as null.)
Recommended Posts