Zain Rizvi
Zain Rizvi

Reputation: 24636

Binding DocumentDb Query to Azure Functions input

Is it possible to bind a documentDb query to the input on an Azure Function?

I don't need the query to be a trigger, but I'd like to pass the results of the query in when my function is triggered

Upvotes: 1

Views: 1010

Answers (2)

Fabio Cavalcante
Fabio Cavalcante

Reputation: 12538

Zain,

Currently, you're limited to setting the document ID. Advanced queries are not supported by the binding.

The alternative is to bind to the client and execute the query directly.

We have an issue tracking that here: https://github.com/Azure/azure-webjobs-sdk-script/issues/289

Upvotes: 1

Larry Maccherone
Larry Maccherone

Reputation: 9523

Sure, you can make calls out to DocumentDB from an Azure Function. Collect whatever parameters you need from the Azure Function call, compose your query, send it out to DocumentDB, wait for the results, and respond to the Azure Function call (assuming you are using an HTTP trigger).

I use node.js to access DocumentDB and the SDK seems to load fine as a package.json dependency from within Azure Functions. I suspect the same is true with .NET.

Upvotes: 1

Related Questions