0
votes

I need to insert a new document when it's given a new 'id' but the partition key is the same as an existing document's partition key. However it gives me a DocumentClientException. Why is this? Shouldn't I be able to have multiple documents with the same partition key value?

It gives me this error although I'm actually giving it a new 'id' that doesn't already exist.

com.microsoft.azure.documentdb.DocumentClientException: Entity with the specified id already exists in the system., 
RequestStartTime: 2019-04-11T15:36:19.7657781Z, RequestEndTime: 2019-04-11T15:36:19.7657781Z, Number of regions attempted: 1
ResponseTime: 2019-04-11T15:36:19.7657781Z, StoreResult: StorePhysicalAddress: rntbd://sn4prdapp19-docdb-1.documents.azure.com:14030/apps/59d3b9ef-17ca-4bbf-8a11-39d0199a8d29/services/27f87c68-85a5-44ec-b1cf-bfc46347392b/partitions/6ddeca7e-1056-4ed7-b70f-5472223dde1c/replicas/131974948271521006p/, LSN: 495, GlobalCommittedLsn: 495, PartitionKeyRangeId: 0, IsValid: True, StatusCode: 409, SubStatusCode: 0, RequestCharge: 1.57, ItemLSN: -1, SessionToken: 0#495#4=-1, UsingLocalLSN: False, TransportException: null, ResourceType: Document, OperationType: Create
, Microsoft.Azure.Documents.Common/2.2.0.0, StatusCode: Conflict
1
The uniqueness factor is the combination of id and partition key value. As long as you don't have more than one documents with this combination you shouldn't have a conflict.Nick Chapsas
I had a conflict when inserting new 'id' but existing partition key but it was because a separate unique field causing the issueArtanis

1 Answers

0
votes

The issue involved a separate field being defined as unique in the collection