Is a section key required when searching by document ID

Is it possible to get a document by its identifier without specifying a section key?

My understanding of reading documentation is that the request will be deployed across all sections if the section key is not specified:

In the next query there is no filter on the partition key (DeviceId) and is deployed to all partitions where it runs against the partition index. Note that you must specify EnableCrossPartitionQuery (x-ms-documentdb-query-enablecrosspartition in the REST API) for the SDK to execute the query through the partitions .

This makes sense with non-key properties, but given the identifier, it is handled specially, I hope that I will not need to allow cross-sectional requests for it.

If I need to enable cross-sectional queries, will it be an expensive operation?

+5
source share
1 answer

A simple identifier request will perform a cross section operation. You must include the section key in these requests in FeedOptions.PartitionKey or as part of a filter. In DocumentDB, the identifier is not unique to all documents in the collection. Instead, the combination of "section key" and "id" is the primary key and uniquely identifies documents within the collection.

Some applications encode a section key as part of an identifier, for example. the section key will be the customer’s identifier, and ID = "customer_id.order_id" , so you can extract the section key from the ID value.

+7
source

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


All Articles