Skip to content

Add Azure Cosmos DB for MongoDB trigger, input, and output bindings#418

Open
xingfan-git wants to merge 2 commits intov4.xfrom
xingfan/onboarding_mongodb_extension_nodejs
Open

Add Azure Cosmos DB for MongoDB trigger, input, and output bindings#418
xingfan-git wants to merge 2 commits intov4.xfrom
xingfan/onboarding_mongodb_extension_nodejs

Conversation

@xingfan-git
Copy link
Copy Markdown

Summary

This PR adds Node.js SDK support for the Azure Cosmos DB for MongoDB bindings, enabling
developers to trigger functions on MongoDB change stream events and read/write documents
from MongoDB collections using the Azure Functions programming model.

Changes

New Features

  • app.cosmosDBMongo() — New function registration method for Cosmos DB for MongoDB
    triggered functions
  • trigger.cosmosDBMongo() — New trigger factory for monitoring MongoDB change streams
    (supports Collection / Database / Cluster level)
  • input.cosmosDBMongo() — New input binding factory for reading documents from a MongoDB
    collection, with optional queryString filter support
  • output.cosmosDBMongo() — New output binding factory for upserting documents into a
    MongoDB collection
  • Type definitions for CosmosDBMongoTriggerOptions, CosmosDBMongoTrigger,
    CosmosDBMongoFunctionOptions, CosmosDBMongoHandler, CosmosDBMongoInputOptions,
    CosmosDBMongoInput, CosmosDBMongoOutputOptions, and CosmosDBMongoOutput

Binding Type Strings

Binding Type string
Trigger cosmosDBMongoTrigger
Input cosmosDBMongo
Output cosmosDBMongo

Tests

Added test/cosmosDBMongo.test.ts with 12 test cases covering trigger, input, and output —
verifying type strings, all binding options, deterministic binding name generation, and
correct direction values via toCoreFunctionMetadata.

@xingfan-git xingfan-git requested a review from a team as a code owner March 27, 2026 03:04
@swapnil-nagar
Copy link
Copy Markdown
Contributor

@xingfan-git do you have a sample app, which would help me validate the changes?

Copy link
Copy Markdown
Contributor

@swapnil-nagar swapnil-nagar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sample app to validate this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants