IDocumentClient - Read a partition?
See original GitHub issueIs it possible to read all documents in a partition in a single round trip?
I have tried CreateDocumentQuery
, but that still seems to result in two server trips, which is less than ideal.
var files = _documentClient.CreateDocumentQuery<TDataType>(_documentCollectionUri, new FeedOptions
{
PartitionKey = new PartitionKey(partitionKey.ToString()),
MaxItemCount = 100
}).ToList();
Note that the trips below are from a query which only has 2/3 records, paging should have had no effect.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (5 by maintainers)
Top Results From Across the Web
c# - Repository that support query by partition key without ...
I am developing an application that using IDocumentClient to perform query to CosmosDB. My GenericRepository support for query by Id and ...
Read more >IDocumentClient.ExecuteStoredProcedureAsync Method
Executes a stored procedure against a partitioned collection in the Azure Cosmos DB service as an asynchronous operation, specifiying a target partition.
Read more >Exploring the new .NET Cosmos DB SDK (v3)
Okay so we created an entity, how can we read it back? CosmosItemResponse<TestEntity> res = await container.Items.ReadItemAsync<TestEntity>( ...
Read more >Partitioning strategies for Cosmos Database SQL API - Part 1
In the first part of this series, the engineering team shares their partitioning strategies for Cosmos Database SQL API. Read the blog now....
Read more >Cosmos DB read a single document without partition key
Posting as answer. Yes you have to do a fan out query but id is only distinct per partition key so even then...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much for taking the time to walk me through this. I have implemented the changes we discussed and it has improved first load for users by 95%!
You can avoid it warming up the caches. The first request on a Client requires the addresses to be resolved for the container you want to interact with, this happens with V2 or V3 SDK, there is no way to get those addresses without doing a request. That request happens on your first ever request to the container, not the rest.
If you do a Read for an item that does not exist on initialization (this could be when the Function App is starting or when you are creating the Singleton client), that would do the required address resolution and not impact the actual list you are doing later.