triggers

Create a trigger

Changed on

Create a new trigger in your application.

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

Request

  • Base URL
    https://services.cloud.mongodb.com/api/admin/v3.0
  • URL
    https://services.cloud.mongodb.com/api/admin/v3.0/groups/{groupId}/apps/{appId}/triggers
  • Auth
    HTTP bearer

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

    • breaking

      the request property //////// became required

    • breaking

      the request property //////// became required

    • breaking

      the request property //////// became required

    • info

      the response property //////////// became required for the status

    • info

      the response property //////////// became required for the status

    • info

      the response property //////////// became required for the status

    • breaking

      the response property ////////// became optional for the status

    • breaking

      the response property ////////// became optional for the status

    • breaking

      the response property ////////// became optional for the status

    • breaking

      the response property ////////// became optional for the status

    • breaking

      the response property ////////// became optional for the status

    • breaking

      the response property ////////// became optional for the status

    • warning

      removed subschema #1 from the request body allOf list

    • info

      added to the request body oneOf list

    • info

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

    • info

      removed the DELETE enum value from the /////////// response property for the response status

    • info

      removed the INSERT enum value from the /////////// response property for the response status

    • info

      removed the REPLACE enum value from the /////////// response property for the response status

    • info

      removed the UPDATE enum value from the /////////// response property for the response status