Closed fjanon closed 4 years ago
Found the fix from this doc:
https://docs.microsoft.com/en-us/rest/api/cosmos-db/create-a-document#example
x-ms-documentdb-partitionkey: ["Andersen"]
The documentdb.PartitionKey should be the partition key value, not its name:
In my code, documentdb.PartitionKey("lat")) should be documentdb.PartitionKey(42)), 42 being the value of the partition key in the document
It looks like something has changed in the REST API for client.CreateDocument:
ERROR: BadRequest, Message: {"Errors":["PartitionKey extracted from document doesn't match the one specified in the header"]}
My code:
type Place struct { documentdb.Document // Your external fields Id string
json:"id,omitempty"
Lat intjson:"lat,omitempty"
}response, err = client.CreateDocument(selfPlacesCollection, &newplace, documentdb.PartitionKey("lat"))
Any ideas on how to fix that?
Thanks