question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[CosmosDBTrigger] Support single Document for binding

See original GitHub issue

Right 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:open
  • Created 6 years ago
  • Reactions:6
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
mikhailshilkovcommented, Oct 3, 2017

It would also be nice to support single typed document, i.e. with a custom C# class instead of Document.

2reactions
paulbatumcommented, Mar 23, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found