Skip to content

Commit

Permalink
merge docsp-33274 / PR #612 to sinmplify
Browse files Browse the repository at this point in the history
  • Loading branch information
MongoCaleb committed Oct 17, 2023
2 parents aa52585 + 14f6370 commit 785e508
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 12 deletions.
27 changes: 22 additions & 5 deletions source/reference/config/triggers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ Database Triggers

Database trigger configurations conform to the base trigger schema with
additional configuration options that specify which collection to watch and when
to fire the trigger. The following fields exist in *database* trigger
configuration files:
to fire the trigger. The following fields exist in *database* and *deployment*
trigger configuration files:

.. code-block:: json
:caption: triggers/<trigger name>.json
Expand Down Expand Up @@ -138,23 +138,40 @@ configuration files:

* - | ``config.database``
| String
- The name of the MongoDB database that contains the watched collection.
- The name of the MongoDB database that contains the watched collection.
Optional.

* - | ``config.collection``
| String
- The name of the collection that the trigger watches.
- The name of the collection that the trigger watches. Optional.

* - | ``config.operation_types``
| String[]
- A list of one or more :ref:`database operation
types <database-event-operation-types>` that cause the trigger to fire.

Valid operations types:
Valid operations types for all triggers:

- ``"INSERT"``
- ``"UPDATE"``
- ``"REPLACE"``
- ``"DELETE"``

Valid operations types for database and deployment triggers:

- ``"CREATE_COLLECTION"``
- ``"MODIFY_COLLECTION"``
- ``"RENAME_COLLECTION"``
- ``"SHARD_COLLECTION"``
- ``"DROP_COLLECTION"``
- ``"RESHARD_COLLECTION"``
- ``"REFINE_COLLECTION_SHARD_KEY"``
- ``"CREATE_INDEXES"``
- ``"DROP_INDEXES"``

Valid operations types for deployment triggers only:

- ``"DROP_DATABASE"``

.. tip::

Expand Down
42 changes: 35 additions & 7 deletions source/triggers/database-triggers.txt
Original file line number Diff line number Diff line change
Expand Up @@ -344,23 +344,53 @@ following operation types:

.. list-table::
:header-rows: 1
:widths: 10 30
:widths: 30 15

* - Operation Type
- Description

* - **Insert**
* - **Insert Document** (All trigger types)
- Represents a new document added to the collection.

* - **Update**
* - **Update Document** (All trigger types)
- Represents a change to an existing document in the collection.

* - **Delete**
* - **Delete Document** (All trigger types)
- Represents a document deleted from the collection.

* - **Replace**
* - **Replace Document** (All trigger types)
- Represents a new document that replaced a document in the collection.

* - **Create_Collection** (Database and Deployment trigger types only)
- Represents the creation of a new collection.

* - **Modify_Collection** (Database and Deployment trigger types only)
- Represents the modification collection.

* - **Rename_Collection** (Database and Deployment trigger types only)
- Represents collection being renamed.

* - **Drop_Collection** (Database and Deployment trigger types only)
- Represents a collection being dropped.

* - **Shard_Collection** (Database and Deployment trigger types only)
- Represents a collection changing from unsharded to sharded.

* - **Reshard_Collection** (Database and Deployment trigger types only)
- Represents a change to a collection's sharding.

* - **Refine_Collection_Shard_Key** (Database and Deployment trigger types only)
- Represents a change in the shard key of a collection.

* - **Create_Indexes** (Database and Deployment trigger types only)
- Represents the creation of a new index.

* - **Drop_Indexes** (Database and Deployment trigger types only)
- Represents an index being dropped.

* - **Drop_Database** (Deployment trigger type only)
- Represents a database being dropped.

Database change event objects have the following general form:

.. code-block:: json
Expand Down Expand Up @@ -747,8 +777,6 @@ the trigger to fire. For details, see the reference for each event type:
- :manual:`replace </reference/change-events/replace>`
- :manual:`delete </reference/change-events/delete>`



.. example::

The following match expression allows the Trigger to fire
Expand Down

0 comments on commit 785e508

Please sign in to comment.