I have a JSON document, which I need to push to azure cosmos db. I am using DocumentDB data migration tool to dump my json file to azure cosmos DB. The problem is my JSON contains an id field which is same for all the records. For e,g.
"angularAcceleration_T12_x:-0.137993,"id":"5946001","jointAngle_jRightHip_z"
And because of this id field, I am not able to insert more than 1 record in my collection as after inserting one record I get an error message "resource with specified id already exist". Is there a way to force cosmos DB to ignore the id field in JSON and create a GUID for each entry, like it does if it does not find an id field.
Thanks, Yaju
Every resource within an Azure Cosmos DB database account needs to have a unique identifier.
CustomerID properties contain the same value in the Cosmos document, it's unlikely that bugs will occur in code regardless of which property is used. However, if the Customer.ID is an auto-generated GUID and the Customer.
The item ID is a great partition key choice for the following reasons: There are a wide range of possible values (one unique item ID per item). Because there is a unique item ID per item, the item ID does a great job at evenly balancing RU consumption and data storage.
After a lot of searching i came to the verdict that if you have a column named "id"(case sensitive) in your json, cosmos db will be make that column value as the id for the document, you can not use any other column as the unique identifier. If cosmos does not find id field, it will create a GUID as the id for the document.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With