I'm trying to work my way around DB notifications for document events in an Azure Function using CosmosDBTrigger
.
I get notified for inserts and updates, however there is no notification for deletion. Is there any way to have it triggered or by design such type of events are not expected? (eg, event sourcing)
In case of an update, is there any way to check if it is an insert or an update? Maybe looking at the ETag
?
There are no deletes in Cosmos DB change feed, so Functions aren't triggered either:
The change feed includes inserts and update operations made to documents within the collection. You can capture deletes by setting a "soft-delete" flag within your documents in place of deletes
And there's no insert/update attribute available out-of-the-box, they suggest you do that on application level:
There is no system property yet. However, you can add an attribute to the document, to do a soft update by updating the document attribute.
Both from quotes are from Working with the change feed support in Azure Cosmos DB
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With