Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

Azure Cosmos Db Trigger not working with Azure Cosmos DB API for MongoDB account Mongo API Database Collection

Open kathleenwest opened this issue 4 years ago • 1 comments

Azure Cosmos Db Trigger not working with Azure Cosmos DB API for MongoDB account Mongo API Database Collection

Where

Azure Portal

What

  1. Azure Function App with Function Azure Cosmos Db Trigger
  2. Azure Cosmos DB API for MongoDB account (Mongo API Database + Collection)

How

Upon trigger of update, create, modify, or change of the Mongo API Database collection, the Azure function is not triggered, and this is verified by the log output as shown in the video.

The attached short video shows the setup of the Azure Function integration + Cosmos DB and it not being triggered after the database collection change.

https://user-images.githubusercontent.com/28828668/155247090-6e97a785-8c13-4df2-ab58-da0ee8ccf8b3.mp4

kathleenwest avatar Feb 23 '22 01:02 kathleenwest

@kathleenwest I encountered the same problem with with Azure Cosmos Core API.I would like to know if this problem is still unresolved at the moment.Thanks

yuhuyuyu avatar Mar 17 '22 11:03 yuhuyuyu

Hi @ealsur Could you please help with this issue?

Ved2806 avatar Aug 25 '22 16:08 Ved2806

This is by design. The Cosmos DB bindings and triggers are for the SQL API.

See the Functions doc: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2?tabs=in-process%2Cfunctionsv2&pivots=programming-language-csharp#supported-apis

ealsur avatar Aug 25 '22 18:08 ealsur

This is by design. The Cosmos DB bindings and triggers are for the SQL API.

See the Functions doc: https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-cosmosdb-v2?tabs=in-process%2Cfunctionsv2&pivots=programming-language-csharp#supported-apis

Just to clarify ^, you are saying Azure does not currently have feature support the Mongo API for the Azure Cosmos Db Trigger

kathleenwest avatar Aug 25 '22 18:08 kathleenwest

There is no Extension for Azure Functions to provide Trigger or Binding functionality for a Mongo API account at this moment. The extension Microsoft.Azure.WebJobs.Extensions.CosmosDB is purely for SQL API operations.

ealsur avatar Aug 25 '22 19:08 ealsur

It is technically possible for a user to build a Trigger Extension that uses the Mongo Driver and Change Streams to obtain and report Mongo changes: https://docs.microsoft.com/azure/cosmos-db/change-feed#change-feed-in-apis-for-cassandra-and-mongodb

At this point, there isn't one created and maintained by Microsoft (doesn't mean there never will, just stating the current scenario).

ealsur avatar Aug 25 '22 19:08 ealsur

Microsoft does not currently support the feature

kathleenwest avatar Aug 25 '22 20:08 kathleenwest