I have setup up an Azure Function to trigger whenever there is a change in CosmosDB, thereby making it a CosmosDBTrigger. It seems the function is being called twice. I know this by looking into the monitor. The two calls occur within few minutes of each other.
I am not sure why the same function would get called twice or is there a setting somewhere to cause this?
The Trigger internally leverages the Cosmos DB Change Feed Processor Library, so your Function will receive batches of inserted / modified documents.
The size of the batch depends on the frequency of the operations. If you are inserting 1 document every second, your function might probably fire with a batch of 1 document several times; if you insert 10 documents every second, the batch will have those 10 documents. It's not a direct relationship with docs/second but just so you get the idea that the Function will always get a batch, and the batch size depends on the volume of operations.