I'm building a durable function that periodically processes every record in my Cosmos DB (nights and weekends). Right now I only have a few hundred records, but once I get into production, I'm anticipating >50k documents to come in with ~1k per week being added.
I am getting the documents via an activityTrigger
with the following bindings:
{
"bindings": [
{
"name": "name",
"type": "activityTrigger",
"direction": "in"
},
{
"type": "cosmosDB",
"direction": "in",
"name": "articles",
"databaseName": "Arts",
"collectionName": "ArtData",
"connectionStringSetting": "CosmosTrigger_ConnectionString",
"sqlQuery": "SELECT * FROM c WHERE c.type='article'"
}
],
"scriptFile": "../dist/GetAllArticleData/index.js"
}
Is there a limit to the total number of documents that are returned to an Azure Function via an SQL Query binding? Or does Azure Functions automatically handle the pagination and there is no upper limit?
If there is no pagination built in, what about chaining durable functions together, where the first activity gets the total row count, then a fan out/in query function is called with the OFFSET and LIMIT clauses being parameters passed in from the orchestrator? Is that a reliable pattern?