Closed ben790924 closed 2 years ago
This is a pretty straightforward issue -- when you created your Cosmos DB table you had to specify a partitionKey path, let's say /myPartitionKey
When you insert documents into Cosmos DB you need to ensure your document contains this key at the right level, so in this example there has to be a top level attribute myPartitionKey
. Additionally, you need to provide the partition key via the documentdb.PartitionKey param.
It's been a long time since then. I've solved this problem. Still, Thanks for your explanations =)
I use documentdb.CreateDocument method and It logged this message below:
BadRequest, Message: {"Errors":["PartitionKey extracted from document doesn't match the one specified in the header"]}
And this is my code:
The same way using type documentdb methods like QueryDocument、QueryCollections works fine.
Also, I'm new to GO and I've searched all over the internet but nothing helps.
Any help will be appreciated