1

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

5
  • Have a look at the documentation: azure.microsoft.com/en-us/documentation/articles/… you can specify an output binding to do what you need Commented Oct 26, 2016 at 19:47
  • @Thomas I'm looking for an input binding that will give me the results of a query. Not an output binding, which would let me add a new document Commented Oct 26, 2016 at 19:59
  • And do the input binding in the documentatoin can match your requirement ? Commented Oct 26, 2016 at 22:38
  • @Thomas Not as far as I can see. If I'm missing a binding option please let me know. Note that, I'm looking for the results of a query, which could be multiple results. The as far as I can tell the input bindings only give a single document. Commented Oct 26, 2016 at 23:28
  • Yeah seems that you need to implement your own binding :-) Commented Oct 27, 2016 at 1:47

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

1

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.

1 Comment

yeah, I know I could manually invoke DocumentDb. I was hoping for a solution where the Azure Functions framework would do most of the connection management work for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.