Ask Your Question

Why does querying by partition key using EF Core Cosmos DB not yield any results?

asked 2021-07-04 11:00:00 +0000

qstack gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-06-27 14:00:00 +0000

devzero gravatar image

There are several reasons why querying by partition key using EF Core Cosmos DB may not yield any results:

  1. Partition Key Value: Ensure that the partition key value being used in the query matches the value that was used when creating the document. If the partition key value is incorrect, the query will not return any results.

  2. Partition Key Definition: Ensure that the partition key definition in the model is correct. The partition key property needs to be annotated with the [PartitionKey] attribute and its name needs to match the partition key property in the document.

  3. Consistency Level: EF Core Cosmos DB supports strong consistency as well as eventual consistency. If the consistency level used for the query is different from the consistency level used when the document was created, the query may not return any results.

  4. Indexing: Ensure that the document is indexed properly. If the indexing is not set up correctly, the query may not return any results.

  5. Query Syntax: Ensure that the query syntax is correct. If the query syntax is incorrect, the query may not return any results.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer

Question Tools


Asked: 2021-07-04 11:00:00 +0000

Seen: 10 times

Last updated: Jun 27 '21