[CosmosDBTrigger] Support single Document for binding
See original GitHub issueRight now we only support IReadOnlyList<Document>
as an input type. That makes it tough to bind to anything at runtime b/c you could have many documents, which means that we don’t know which one to look at for your binding values (i.e. if you want to take a changed document and do an auto-lookup for related documents using a CosmosDB input binding).
Right now you have to either move to multiple functions joined by a queue or do the work yourself with DocumentClient internally. If we could support Document
by itself as a trigger object somehow, that’d open up the possibility to have richer runtime binding here.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:13 (8 by maintainers)
Top Results From Across the Web
Azure Cosmos DB bindings for Functions 2.x and higher
Azure Cosmos DB bindings are only supported for use with Azure Cosmos DB ... Cosmos DB trigger (single document), JSON serializable types 1....
Read more >Cosmos DB Trigger not working due to binding error
Binding can only be done with IReadOnlyList<Document> or JArray Parameter name: type. Supposedly the reason for this is because I'm referencing ...
Read more >Working with Azure Cosmos DB in your Azure Functions
We can invoke our Azure Functions with a CosmosDB Trigger, ... Azure Functions triggers and bindings only support the SQL API.
Read more >Working with Azure Cosmos DB in your Azure Functions
Tagged with azure, tutorial, csharp, cosmosdb. ... time of me writing this, Azure Functions triggers and bindings only support the SQL API.
Read more >Handle events with Azure Functions and Azure Cosmos DB ...
... More info here: https://aka.ms/learnlive-azure- cosmosdb -cert-Ep14 Follow ... bindings to integrate a function with Azure Cosmos DB SQL API.
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
It would also be nice to support single typed document, i.e. with a custom C# class instead of
Document
.Yeah I’m not sure we should add this capability. Cosmos DB and Event Hubs have a lot in common when it comes to performance, and my findings for Event Hubs were that it is massively slower (and in the consumption plan, more expensive!) to write functions that receive a single EventData rather than an array. I’ve had a number of support cases that ended up being root caused to this issue. I’m considering a breaking change in V2 that would force event hubs to only support batched mode.
As @ealsur points out, a user can work around this by introducing a queue. This will work fine in low throughput scenarios. In high throughput scenarios, the developer really needs to do their processing in batches.