The following project contains samples using Azure Function's Cosmos DB Input Binding.
It contains 3 different samples:
- HttpInputBindingByIdInBody: Use an HTTP POST to query for a particular document in a container by matching part of the POST's body to the Id of the document.
- HttpInputBindingByIdInRoute: Use an HTTP GET to query for a particular document in a container by matching part of the GET's route to the Id of the document.
- HttpInputBindingWithQuery: Use an HTTP POST to query for a list of documents matching a custom query using the POST's body attributes as filters.
- HttpInputBindingMultiMaster: Use an HTTP POST to query for a list of documents matching a custom query using the POST's body attributes as filters, defining preferred connection regions, and enabling Multi Master support.
You can use Visual Studio Code, Visual Studio or even the Azure Functions' CLI. You only need to customize the local.settings.json file to match the Cosmos DB Connection String, Database name, and Collection name on which you want the queries to run.