When creating the document with Azure Cosmos DB: MongoDB API, I am facing the below issues which varies on parameters.
When creating collection UserProfile, I've created it with Partition Key username.
Request1: - Without Partition Key
Headers:
x-ms-documentdb-is-upsert: true
Body:
{"username": "test"}
Issue:
The partition key supplied in x-ms-partitionkey header has fewer components than defined in the the collection.
Request2: - With Partition Key
Headers:
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
Body:
{"username": "test"}
Issue:
One of the specified inputs is invalid
Request3: - With Partition Key & id specified in body
Headers:
x-ms-documentdb-is-upsert: true
x-ms-documentdb-partitionkey: ["username"]
Body:
{"id": "test", "username": "test"}
Issue:
PartitionKey extracted from document doesn't match the one specified in the header
In any case,
I am not able to create the document. What are the necessary parameters to create the document which has partition specified?