Sponsor: Do you build complex software systems? See how NServiceBus makes it easier to design, build, and manage software systems that use message queues to achieve loose coupling. Get started for free.I received a comment on my Azure Cosmos DB Transactions from .NET post from Onur:
The thing I don’t like about Azure Cosmos DB is that it doesn’t support aggregations nor paging.This was actually some pretty good timing of this comment as I just ran into a situation of a side project that required to page through a result set.
Skip & TakeIt does not appear that Azure Cosmos DB supports (yet) SKIP and TAKE, which you would expect to use in order to do paging. Because of this, you can’t implement all the same functionality you might expect. But there is a a way to limit the number of records returned in a query and subsequently having the next query return the records were the previous query left off. This means you can basically continue through your result set.
ContinuationsAzure Cosmos DB has the concept of a
continuationTokenwhich is returned from a query which limits the number of records to return. When using the
CreateDocumentQuery<T>from the .NET SDK, you can specify an additional parameter for FeedOptions.
FeedOptionsHere’s an example of using
FeedOptionsto limit the number of results: