Thanks for the Question and using Microsoft Q&A.
Can you help me understand the
GetItemQueryIterator<>
method in Cosmos DB?
The GetItemQueryIterator<T>
method in Cosmos DB is used to create a query for items in a container using a SQL statement. It returns a FeedIterator<T>
that can be used to iterate through the results.
does it throw an exception if no records are found in the databaseT
The GetItemQueryIterator<T>
method does not throw an exception if no records are found. Instead, it returns an empty result set. You can check if there are more results by using the HasMoreResults
property of the FeedIterator<T>
.
does it query and return results partition by partition?
Yes, the method can query and return results partition by partition. If you specify a partition key in your query, Cosmos DB will optimize the query to target only the relevant partitions. If no partition key is specified, the query will fan out to all physical partitions.
Please go through these Documentations that might help you:
https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/how-to-query-container
Hope this helps. Do let us know if you any further queries.
If this answers your query, do click Accept Answer
and Yes
for was this answer helpful. And, if you have any further query do let us know.