Atlas Mongo Triggers & Match Expressions

I am testing out Atlas Triggers and cannot get the Mach Expressions working.

I am inserting a simple document that looks like this:

   {
    "description": "Insert Test",
    "notify": true,
    "createdAt": new Date(),
    "userId": "1234567890"
}

If I leave the match expression as an empty object {} , the trigger works as expected and I see the event on the AWS EventBridge.

If I add the following Match Expression:

{ 
"notify" : true
}

The trigger no longer executes and I do not see the event on the AWS Event Bridge. Am I configuring the Match Expression inaccurately? I only want the trigger to execute when the notify field is set to true

Thanks

Hi – For the match expression in the Trigger, you will want to match on the Change Event format vs. the document itself. Specifically, I think that field will be located within the either updateDescription / fullDocument fields depending on how you have configured the Trigger.

Hi @Drew_DiPalma, can you supply an example based on the document example I supplied in the original question?

I tried { "fullDocument.notify": true }

and

{
 "updateDescription.updatedFields": {
  "notify":true
 }
}

Neither worked.

Thanks.

Have you tried –
{
“updateDescription.updatedFields.notify”:true
}

I tried

{
“updateDescription.updatedFields.notify”:true
}

Still not working, keep in mind this is for an insert event, not an update.

Thanks.

Figured this out, in order for this to work you need to enable the Full Document option in the trigger settings. Then the following Match Expression will work:

{
“fullDocument.notify”:true
}

This post was also helpful

Thanks

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.