MongoDB Trigger for Azure Functions

Azure Functions don’t have a trigger for MongoDB right out of the box. Is there some custom MongoDB trigger out there that will allow for me to take advantage of Change Streams in MongoDB? Ideally, I would like to find a MongoDB trigger equivalent to the “CosmosDB” trigger in Azure Functions that takes advantage of Change Feed. If that doesn’t exist, is there some other way that I can take advantage of MongoDB change stream with Azure Functions? We use Azure Functions extensively and need some way to incorporate it with MongoDB. Specifically, we need a trigger for database changes in MongoDB. I’ve seen examples of using Azure Functions with MongoDB with a Http Trigger, but we need a trigger that makes use of the MongoDB change stream.

1 Like

Hi Sam – Have you looked at Atlas Triggers? These are essentially serverless functions attached to Change Streams and will allow you to call into an Azure Function or simply write your business logic within the function in Atlas.

1 Like

Yeah, I’ve been looking into the Atlas Functions. That’s my backup plan. I was just hoping that there was some MongoDB trigger for Azure Functions out there somewhere to make our lives easier since we’re extensively using Azure Functions in our application.

What is your Azure Function written in? Many mongodb drivers have change stream features. And there is one for .NET. Listening to a change stream isn’t really serverless, but it could be a nice option if you want to stay in your language. Otherwise you need to create an Atlas Trigger and function that will call your HTTP trigger for an azure function or something like that.

It’s written in c#. I suspect I will have to use Atlas Functions since Microsoft only cares about CosmosDB triggers.