Atlas Triggers
AI-generated content
This document was generated by an AI assistant. Verify accuracy before relying on the details.
The producer side of every async ADB event is a MongoDB Atlas Trigger — a server-side function that watches a single collection's change stream and pushes a transformed message to AWS EventBridge (or, for two internal cases, to a Realm function). Triggers are NOT managed by the new infra/ Pulumi project — they live in the Atlas App Services app triggers-kkeqz and are deployed via realm-cli. The legacy management scripts are in adb-infrastructure/mongodb-atlas/realm-cli/triggers/.
At a glance
| Fact | Value | Source |
|---|---|---|
| Atlas project | adb-prod (65b269f45146181dace9b228) | atlas projects list |
| Cluster | adb-prod (M20, MongoDB 8.0.21, Azure FRANCE_CENTRAL) | atlas clusters describe adb-prod |
| Realm app | triggers-kkeqz, region aws-eu-west-1, deployment LOCAL | realm-cli pull |
| Trigger count | 18 (16 → AWS EventBridge, 2 → internal Realm functions) | realm-cli pull |
| AWS target | account 182790345476, region eu-west-3 | trigger event_processors.AWS_EVENTBRIDGE.config |
| Time zone in payloads | Europe/Paris | trigger project.requestContextData |
Details
Trigger inventory
Producer-side mapping (database, collection, operations watched):
| Trigger | DB | Collection | Ops | → AWS |
|---|---|---|---|---|
| accounting-entry-modified | adb-accounting | domain_object_accounting_entry | I/U/R/D | ✅ |
| accounting-event-modified | adb-accounting | accounting_event | I/U/R/D | ✅ |
| auxiliary-account-balance-updated | adb-accounting | ledger_auxiliary_account | U/R | ✅ |
| payment-modified | adb-accounting | payments | I/U/R/D | ✅ |
| contract-modified | adb-contracts | contracts | I/U/R/D | ✅ |
| direct-debits-status-processed | adb-contracts | direct_debits | U/R | ✅ |
| dunning-notice-sent | adb-contracts | dunnings | I/U | ✅ |
| file-metadata-modified | adb-files | files | I/U/R/D | ✅ |
| index-created | adb-utilities | indexes | I | ✅ |
| organization-modified | adb-persons | organization | I/U/R/D | ✅ |
| person-modified | adb-persons | persons | I/U/R/D | ✅ |
| part-modified | adb-parts | parts | I/U/R/D | ✅ |
| parts-charge-budget-modified | adb-parts | charges | I/U/R/D | ✅ |
| parts-market-performance-modified | adb-parts | market_performances | I/U/R/D | ✅ |
| ticket-event-modified | adb-tickets | events | I/U/R/D | ✅ |
| ticket-modified | adb-tickets | tickets | I/U/R/D | ✅ |
| notification-definition-modified | adb-utilities | notification_definitions | I/U/R/D | ❌ → Realm fn — superseded, see below |
| notification-ttl-deleted | adb-utilities | notifications_ttl | D | ❌ → Realm fn — superseded, see below |
The two notification Realm functions (superseded)
Together they used to perform the banner fan-out described in adb-utilities → Notification fan-out:
notification-definition-modifiedrunsdev_notification_definition_created_updated_deleted_replaced_function.js: when the changed definition'sstateisNOTIFICATION_DEFINITION_STATE.ACTIVEit upserts{ _id: <definition id>, organisationId, start: schedule.start }intonotifications_ttl(a TTL index withexpireAfterSeconds: 0onstart, seeadb-infrastructure/mongodb-atlas/data-scripts/create_notifications_ttl_index.js); on a delete it removes that document.notification-ttl-deletedrunsdev_notification_ttl_deleted_function.jswhen MongoDB expires the TTL document: it loads the definition andinsertManys one organisation-level notification per channel × organisation (organisationId= the target organisation,state: SENT, nouser).
Both functions name the adb-development cluster service and were never provisioned for staging (adb-stage), the local stack or the Cloudflare port — which is why an activated banner reached no user there. Since 2026-09-23 adb-utilities performs this fan-out itself on every definition write (NotificationDefinitionServiceImpl#fanOut, property notifications.fan-out.enabled). Wherever the service fan-out is enabled these two triggers must be disabled (realm-cli → triggers-kkeqz), otherwise every banner is produced twice.
Database naming convention
Each microservice owns its own MongoDB database, named identically: adb-<service> (e.g. adb-contracts, adb-accounting). The adb-tickets database exists and triggers fire on it even though there's no adb-tickets/ directory in the monorepo today.
How to inspect or change a trigger
See MongoDB Atlas — Realm CLI setup for the install + auth steps. Then:
realm-cli login --api-key "$MONGODB_ATLAS_PUBLIC_API_KEY" --private-api-key "$MONGODB_ATLAS_PRIVATE_API_KEY"
realm-cli pull --remote triggers-kkeqz --local /tmp/realm
ls /tmp/realm/triggers
# Each <name>.json has config.{database,collection,operation_types} + event_processors.AWS_EVENTBRIDGE.config
To deploy a change, edit the JSON in the legacy adb-infrastructure/mongodb-atlas/realm-cli/triggers/ checkout (or in your realm-cli pull working copy) and realm-cli push --remote triggers-kkeqz.
Open questions
- Why does every trigger's
projectsetevent: "CREATED"andoperationType: 1as static literals? Real values should come from the change-stream metadata. - Atlas Triggers don't appear in any IaC — they're managed by hand-edited JSON in
adb-infrastructure/. Should they move to a Pulumi MongoDB Atlas provider integration so the newinfra/is the single deploy surface? - The two
notification-*triggers are superseded by the in-service fan-out (see above): when are they disabled onadb-prod, and is thenotifications_ttlcollection + TTL index dropped with them?