I have 2 collections in CosmosDB, Stocks
and StockPrices
.
StockPrices
collection holds all historical prices, and is constantly updated.
I want to create Azure Function that listens to StockPrices
updates (CosmosDBTrigger
) and then does the following for each Document
passed by the trigger:
- Find stock with matching ticker in
Stocks
collection - Update stock price in
Stocks
collection
I can't do this with CosmosDB
input binding, as CosmosDBTrigger
passes a List
(binding only works when trigger passes a single item).
The only way I see this working is if I foreach
on CosmosDBTrigger
List, and access CosmosDB from my function body and perform steps 1 and 2 above.
Question: How do I access CosmosDB from within my function?