Open graham-sportsmgmt opened 7 years ago
You may use the supported DocumentClient
binding. Kindly see example at: https://github.com/Azure/azure-webjobs-sdk-extensions#documentdb
I'm sorry, but I didn't see any references to DocumentDB Stored Procedures on that page. Am I missing something, or perhaps looking in the wrong spot?
@brettsam - this doesn't work with our DocDB SQL support today?
@christopheranderson -- I don't see anything in the documentation that indicates you can write a SQL query that will execute a stored procedure. I've asked the DocDB team to verify.
@graham-sportsmgmt -- @tohling is talking about using a DocumentClient
parameter in your function signature. We'll give you the client and you can use that to execute stored procedures directly using the API. You're right that there's no support for input/output bindings today, but using the client directly should allow you to build the complex interactions you want. We'll keep this open and discuss how we could design this.
@brettsam thanks for the clarification.
First, let me say that I would not expect a Function to create/update/delete a Stored Procedure, only execute them. Sproc management is already available to us in the Azure Portal in the feature called "Script Explorer".
Executing the sproc is as simple as passing in zero or more parameters in a JSON array, and then receiving the text output document. This output is not constrained, and could be JSON, plain text, no text, or even XML.
For our app, we use sprocs to:
These are the two main documents detailing DocumentDB sprocs: https://www.documentdb.com/javascript/tutorial https://docs.microsoft.com/en-us/azure/cosmos-db/programming
Is using DocumentClient still the correct way to call a stored procedure ? Or is there a stored procedure binding planned ?
Using DocumentClient is still the way to do this. There's no planned sproc binding, although I think it's possible.
@ealsur -- have you heard much demand for this?
@brettsam - this might be a chicken and egg argument. If CosmosDB SQL was to have better support throughout Azure (and much better documentation) then adoption would probably increase by an order of magnitude.
We've been using it for a few years and are relatively happy, but I have spoken to several other developers who tried it and gave up, moving to the Mongo API to get the rich query engine or Table Storage to get the simplicity, or (bah!) migrated away from Azure altogether.
Please add input and output bindings for DocumentDB stored procedures.
They will be needed for more complex DocumentDB operations that can't be handled in a single query or update.
Thanks!