From 20dac4adf3b47581b7ab44dff8c50a3beb71a509 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Tue, 8 Oct 2024 12:13:47 -0400 Subject: [PATCH 1/5] Update Triggers Admin API reference --- source/openapi-admin-v3.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/source/openapi-admin-v3.yaml b/source/openapi-admin-v3.yaml index 7be56f5f6..c0adeb6c3 100644 --- a/source/openapi-admin-v3.yaml +++ b/source/openapi-admin-v3.yaml @@ -7842,15 +7842,12 @@ components: - database - collection - operation_types - - full_document - - full_document_before_change - - unordered - - match properties: service_id: type: string description: | - The _id value of a linked MongoDB data source. + The `_id` value of a linked MongoDB data source that + contains the watched collection. You can list services with the [Get all services endpoint](#operation/adminListServices). @@ -7935,6 +7932,7 @@ components: option. unordered: type: boolean + default: false description: |- If `true`, event ordering is disabled and this Trigger can process events in parallel. If `false`, event @@ -7964,8 +7962,7 @@ components: type: AUTHENTICATION function_id: 5eea9ca4ca0e356e2c2a148a config: - operation_type: - - CREATE + operation_type: CREATE providers: - api-key allOf: From 370a2ca7095536545bd332f937eb4913a5689a61 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Tue, 8 Oct 2024 12:21:14 -0400 Subject: [PATCH 2/5] Update config reference --- source/openapi-admin-v3.yaml | 2 +- source/reference/config/triggers.txt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/source/openapi-admin-v3.yaml b/source/openapi-admin-v3.yaml index c0adeb6c3..e3cf2bd32 100644 --- a/source/openapi-admin-v3.yaml +++ b/source/openapi-admin-v3.yaml @@ -640,7 +640,7 @@ paths: content: application/json: schema: - "$ref": "#/components/schemas/Trigger" + "$ref": "#/components/schemas/TriggerConstructor" responses: "201": description: Successfully created. diff --git a/source/reference/config/triggers.txt b/source/reference/config/triggers.txt index e85ce579e..00bcae0c5 100644 --- a/source/reference/config/triggers.txt +++ b/source/reference/config/triggers.txt @@ -145,7 +145,7 @@ two possible configurations depending on the event processor type: "type": "DATABASE", "disabled": , "config": { - "service_name": "", + "service_id": "", "database": "", "collection": "", "operation_types": ["", ...], @@ -179,7 +179,7 @@ two possible configurations depending on the event processor type: "type": "DATABASE", "disabled": , "config": { - "service_name": "", + "service_id": "", "database": "", "collection": "", "operation_types": ["", ...], @@ -216,10 +216,10 @@ two possible configurations depending on the event processor type: * - Field - Description - * - | ``config.service_name`` + * - | ``config.service_id`` | ``string`` - - The name of the :ref:`MongoDB data source ` + - The unique identifier of the :ref:`MongoDB data source ` that contains the watched collection. You cannot define a database trigger on a :ref:`serverless instance ` or :ref:`{+adf-instance+} `. From b32a0042c5450ac91cadaf05b129147624c59f41 Mon Sep 17 00:00:00 2001 From: dacharyc Date: Tue, 8 Oct 2024 12:35:08 -0400 Subject: [PATCH 3/5] Enumerate complications of database triggers --- source/openapi-admin-v3.yaml | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/source/openapi-admin-v3.yaml b/source/openapi-admin-v3.yaml index e3cf2bd32..5e90ba698 100644 --- a/source/openapi-admin-v3.yaml +++ b/source/openapi-admin-v3.yaml @@ -7839,8 +7839,6 @@ components: config: required: - service_id - - database - - collection - operation_types properties: service_id: @@ -7857,23 +7855,40 @@ components: the Trigger. database: type: string - description: The name of a database in the linked data source. + description: |- + The name of a database in the linked data source. If you + omit this parameter, the Source Type changes to + "Deployment," unless you are on a shared tier, in which + case App Services will not let you save the trigger. collection: type: string description: |- The name of a collection in the specified database. The - trigger listens to events from this collection. + trigger listens to events from this collection. If you omit + this parameter, the Source Type changes to "Database." operation_types: type: array minItems: 1 items: type: string - enum: - - INSERT - - UPDATE - - REPLACE - - DELETE - description: The type(s) of MongoDB change event that the trigger listens for. + description: |- + The type(s) of MongoDB change event that the trigger + listens for. + + If you specify a collection name, valid operation types + include `"INSERT"`, `"UPDATE"`, `"REPLACE"`, and `"DELETE"`. + + If you specify only a database name, valid + operation types include `"CREATE_COLLECTION"`, + `"MODIFY_COLLECTION"`, `"RENAME_COLLECTION"`, + `"DROP_COLLECTION"`, `"SHARD_COLLECTION"`, + `"RESHARD_COLLECTION"`, and `"REFINE_COLLECTION_SHARD_KEY"`. + + If you omit both collection and database name, the only + valid operation type is `"DROP_DATABASE"`. + + For more information, refer to + [Trigger Configuration](https://www.mongodb.com/docs/atlas/app-services/triggers/database-triggers/#configuration). match: type: object description: |- From 85d4ab37719e01c3c1fadadd292acf648a769bad Mon Sep 17 00:00:00 2001 From: dacharyc Date: Tue, 8 Oct 2024 12:45:27 -0400 Subject: [PATCH 4/5] Actually it's more complicated than that --- source/openapi-admin-v3.yaml | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/source/openapi-admin-v3.yaml b/source/openapi-admin-v3.yaml index 5e90ba698..1be7c907d 100644 --- a/source/openapi-admin-v3.yaml +++ b/source/openapi-admin-v3.yaml @@ -7875,17 +7875,28 @@ components: The type(s) of MongoDB change event that the trigger listens for. - If you specify a collection name, valid operation types - include `"INSERT"`, `"UPDATE"`, `"REPLACE"`, and `"DELETE"`. + Valid operation types for all triggers include: - If you specify only a database name, valid - operation types include `"CREATE_COLLECTION"`, - `"MODIFY_COLLECTION"`, `"RENAME_COLLECTION"`, - `"DROP_COLLECTION"`, `"SHARD_COLLECTION"`, - `"RESHARD_COLLECTION"`, and `"REFINE_COLLECTION_SHARD_KEY"`. - - If you omit both collection and database name, the only - valid operation type is `"DROP_DATABASE"`. + - `"INSERT"` + - `"UPDATE"` + - `"REPLACE"` + - `"DELETE"` + + Additional valid operation types for database and + deployment triggers include: + + - `"CREATE_COLLECTION"` + - `"MODIFY_COLLECTION"` + - `"RENAME_COLLECTION"` + - `"DROP_COLLECTION"` + - `"SHARD_COLLECTION"` + - `"RESHARD_COLLECTION"` + - `"REFINE_COLLECTION_SHARD_KEY"` + + Additional valid operation types for deployment triggers + include: + + - `"DROP_DATABASE"` For more information, refer to [Trigger Configuration](https://www.mongodb.com/docs/atlas/app-services/triggers/database-triggers/#configuration). From 4dcb37c103298cf30620f9c81e2483bf605f6cd4 Mon Sep 17 00:00:00 2001 From: Dachary Date: Tue, 8 Oct 2024 15:01:19 -0400 Subject: [PATCH 5/5] Apply suggestions from review Co-authored-by: cbullinger <115956901+cbullinger@users.noreply.github.com> --- source/openapi-admin-v3.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/openapi-admin-v3.yaml b/source/openapi-admin-v3.yaml index 1be7c907d..862e54478 100644 --- a/source/openapi-admin-v3.yaml +++ b/source/openapi-admin-v3.yaml @@ -7872,7 +7872,7 @@ components: items: type: string description: |- - The type(s) of MongoDB change event that the trigger + The types of MongoDB change event that the trigger listens for. Valid operation types for all triggers include: