triggers

Create a trigger

Create a new trigger in your application.

post/groups/{groupId}/apps/{appId}/triggers

Request body

OR
OR

Example request

{
  "name": "onNewEmployee",
  "type": "DATABASE",
  "function_id": "5eea9ca4ca0e356e2c2a148a",
  "config": {
    "operation_types": [
      "INSERT"
    ],
    "database": "HR",
    "collection": "employees",
    "service_id": "5adeb649b8b998486770ae7c",
    "match": {},
    "project": {},
    "full_document": true
  },
  "event_processors": {
    "FUNCTION": {
      "config": {
        "function_id": "6841b8d3e71dc81bed89dbba",
        "function_name": "Atlas_Triggers_DatabaseInsert_1749137618"
      }
    }
  }
}

Response

Successfully created.

OR
OR

Example response

{
  "name": "onNewEmployee",
  "type": "DATABASE",
  "function_id": "5eea9ca4ca0e356e2c2a148a",
  "config": {
    "operation_types": [
      "INSERT"
    ],
    "database": "HR",
    "collection": "employees",
    "service_id": "5adeb649b8b998486770ae7c",
    "match": {},
    "project": {},
    "full_document": true
  },
  "event_processors": {
    "FUNCTION": {
      "config": {
        "function_id": "6841b8d3e71dc81bed89dbba",
        "function_name": "Atlas_Triggers_DatabaseInsert_1749137618"
      }
    }
  }
}

Changes

Changed in 6 of the 50 revisions of this API.11117

  • v36d67e96bfb4233See the full diff
    • the request property oneOf[AuthenticationTrigger]/allOf[BaseTrigger]/event_processors became required

      request-property-became-required

    • the request property oneOf[DatabaseTrigger]/allOf[BaseTrigger]/event_processors became required

      request-property-became-required

    • the request property oneOf[ScheduledTrigger]/allOf[BaseTrigger]/event_processors became required

      request-property-became-required

    • the response property allOf[TriggerConstructor]/oneOf[AuthenticationTrigger]/allOf[BaseTrigger]/event_processors became required for the status 201

      response-property-became-required

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[BaseTrigger]/event_processors became required for the status 201

      response-property-became-required

    • the response property allOf[TriggerConstructor]/oneOf[ScheduledTrigger]/allOf[BaseTrigger]/event_processors became required for the status 201

      response-property-became-required

  • v351a885fea9ae616See the full diff
    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/collection became optional for the status 201

      response-property-became-optional

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/database became optional for the status 201

      response-property-became-optional

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/full_document became optional for the status 201

      response-property-became-optional

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/full_document_before_change became optional for the status 201

      response-property-became-optional

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/match became optional for the status 201

      response-property-became-optional

    • the response property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/unordered became optional for the status 201

      response-property-became-optional

    • removed TriggerConstructor subschema #1 from the request body allOf list

      request-body-all-of-removed

    • added DatabaseTrigger AuthenticationTrigger ScheduledTrigger to the request body oneOf list

      request-body-one-of-added

    • the unordered response's property default value false was added for the status 201

      response-property-default-value-added

    • removed the DELETE enum value from the allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/operation_types/items/ response property for the response status 201

      response-property-enum-value-removed

    • removed the INSERT enum value from the allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/operation_types/items/ response property for the response status 201

      response-property-enum-value-removed

    • removed the REPLACE enum value from the allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/operation_types/items/ response property for the response status 201

      response-property-enum-value-removed

    • removed the UPDATE enum value from the allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/config/operation_types/items/ response property for the response status 201

      response-property-enum-value-removed

    • added the new optional request property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/error_handler

      new-optional-request-property

    • added the optional property allOf[TriggerConstructor]/oneOf[DatabaseTrigger]/allOf[subschema #2]/error_handler to the response with the 201 status

      response-optional-property-added

  • v3e2240dd053bd22See the full diff
    • added TriggerConstructor subschema #1 to the request body allOf list

      request-body-all-of-added

    • removed DatabaseTrigger AuthenticationTrigger ScheduledTrigger from the request body oneOf list

      request-body-one-of-removed

    • added TriggerConstructor subschema #1 to the response body allOf list for the response status 201

      response-body-all-of-added

    • removed DatabaseTrigger AuthenticationTrigger ScheduledTrigger from the response body oneOf list for the response status 201

      response-body-one-of-removed

    This revision also has 5 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

    • added the new optional request property oneOf[DatabaseTrigger]/allOf[subschema #2]/config/maximum_throughput

      new-optional-request-property

    • added the optional property oneOf[DatabaseTrigger]/allOf[subschema #2]/config/maximum_throughput to the response with the 201 status

      response-optional-property-added

    • added the new optional request property oneOf[DatabaseTrigger]/allOf[subschema #2]/config/project

      new-optional-request-property

    • added the optional property oneOf[DatabaseTrigger]/allOf[subschema #2]/config/project to the response with the 201 status

      response-optional-property-added