DocumentDB REST API: PartitionKey extracted from a document does not match

I am trying to embed a JSON document in DocumentDB via REST using PHP (which does not have an official API shell). Now it seems that the section key has become mandatory for any collection in DocumentDB, but I can not find the REST API documentation.

In response, I get the following error:

PartitionKey extracted from document doesn't match the one specified in the header

The JSON document I'm trying to insert is as follows:

{ id:"1", ... "domain":"domain.com" }

In Azure, I defined a collection using the following section key:

/domain

And when sending a REST request, I send the following header:

x-ms-documentdb-partitionkey: [ "domain" ]

What am I missing here?

+4
source share
1 answer

x-ms-documentdb-partitionkey ("domain.com"), ("domain").

x-ms-documentdb-partitionkey: [ "domain.com" ]

, .

+4

Source: https://habr.com/ru/post/1672783/


All Articles