May 23rd, 2025
likeheart2 reactions

Now in Public Preview: Azure Functions Trigger for Azure Cosmos DB for MongoDB vCore

Sajeetharan Sinnathurai
Principal Program Manager

The Azure Cosmos DB trigger for Azure Functions is now in public preview—available for C# Azure Functions using Azure Cosmos DB for MongoDB vCore!

This new capability allows developers to easily trigger Azure Functions in response to changes in a MongoDB vCore collection, making it simple to build real-time, event-driven applications with minimal setup.

Picture1 image

🔍 What’s New?

Until now, change feed-based triggers in Azure Functions were only available for the API for NoSQL. With this new extension, MongoDB developers using Azure Cosmos DB’s vCore architecture now get first-class serverless support.

The Cosmos DB trigger for MongoDB vCore listens for inserts and updates in your MongoDB vCore collections and automatically calls your Azure Function with the relevant change data—enabling reactive, event-driven workflows with ease.

 

✨ Key Benefits

  • Real-time Processing: React instantly to changes in your MongoDB vCore collections.
  • Simplified Architecture: No need to poll or manage custom change stream logic.
  • Scalable and Serverless: Leverage the power of Azure Functions for effortless scale.
  • Tightly Integrated: Built specifically for the Azure Cosmos DB for MongoDB vCore platform.

🛠 Use Cases

  • Sync data changes across services
  • Trigger workflows or notifications
  • Real-time analytics and dashboards
  • Clean, transform, or enrich data as it’s written

Input and Output Bindings in C# for MongoDB vCore

With Azure Functions and MongoDB vCore, bindings make data access incredibly simple no need to write boilerplate code to connect to your database.

Input Bindings

Input bindings allow your function to read documents directly from a MongoDB vCore collection with just a few lines of code.

Picture4 image

Yes, the same familiar [CosmosDBInput] attribute works with MongoDB vCore – just point it to your vCore connection string.

Output Bindings

Output bindings let you write documents to your MongoDB vCore collection without managing connections or SDKs.

Picture3 image

Trigger Support

You can also react to data changes in MongoDB vCore using Cosmos DB triggers. For example, whenever a document is inserted or updated in a collection, your Azure Function can automatically execute.

Picture5 image

🔧 Getting Started

To get started, use Azure Functions v2 or later with a C# function app, and connect it to your MongoDB vCore account using the new Cosmos DB trigger binding for MongoDB vCore. You’ll find detailed documentation and code samples to walk you through the setup.

This feature is currently in public preview, and your feedback is invaluable as we expand support to additional languages and platforms.

💬 Let Us Know What You Think

We’d love to hear how you’re planning to use this feature or any ideas for improvement. Share your feedback through Azure Feedback  or GitHub issues. Start building serverless MongoDB apps like never before with Cosmos DB for MongoDB vCore and Azure Functions!

Leave a review

Tell us about your Azure Cosmos DB experience! Leave a review on PeerSpot and we’ll gift you $50. Get started here.

About Azure Cosmos DB

Azure Cosmos DB is a fully managed and serverless NoSQL and vector database for modern app development, including AI applications. With its SLA-backed speed and availability as well as instant dynamic scalability, it is ideal for real-time NoSQL and MongoDB applications that require high performance and distributed computing over massive volumes of NoSQL and vector data.

To stay in the loop on Azure Cosmos DB updates, follow us on XYouTube, and LinkedIn.

Author

Sajeetharan Sinnathurai
Principal Program Manager

Principal Product Manager passionate about empowering developers with exceptional tools and experiences. Currently part of the Azure Cosmos DB team, driving developer-focused features like JavaScript SDK, integrations, and tooling for local development etc. Interested in web development or cloud? Let’s connect!

0 comments

Discussion is closed.