I have a Azure function (http triggered) which returns documents from a CosmosDB (SQL API).
CosmosDB has been integrated and works well when i define a SQL QUERY like:
SELECT * FROM c where c.id = {documentID}
when i trigger a http request with the following url i will get the document with ID 1 from the database, as expected.
blub.azure.net/API/myFunc?documentID=1
now i want to use multiple IDs in the parameterized SQL Query. How i am supposed to do this with Azure. Normally i would expect to use something like the following URL and SQL Query to get the desired result, but it will not work:
blub.azure.net/API/myFunc?documentIDs=1&documentIDs=2
SELECT * FROM c WHERE c.id IN ({documentIDs})
NOTE: i know that i can also pass a json string and decode it in the function but the cosmodb has more than 15 million entries and i can't pass it to the function, the filtering should be done on sql side. So i need to use the query feature to prefilter it before it will bound to the function.
my function.json:
{
"bindings": [
{
"authLevel": "function",
"type": "httpTrigger",
"direction": "in",
"name": "req"
},
{
"type": "http",
"direction": "out",
"name": "res"
},
{
"type": "documentDB",
"name": "lastDataPoints",
"databaseName": "dp-db-04",
"collectionName": "lastDataPointsCollection",
"connection": "ldpdbconnectionstring",
"direction": "in",
"sqlQuery": "SELECT * FROM c WHERE c.id = {documentID}"
}
],
"disabled": false
}