I have a mongo trigger sending events to AWS Eventbridge on insert/update to a certain table.
I need to exclude 2 fields from setting off the trigger, as it results in an endless loop when my worker adds the item to a 3rd party system and then updates the table with the ID for the new system, endlessly triggering updates to the table.
The rule i have below works for 1 item, except i cannot figure out how to dynamically look at all “item levels” inside the “SubCategories” array. This only ignores updates to the 0th item in the list, and i have some with upwards for 300 categories so i cant just hardcode 0,1,2,3 over and over. Every attempt i have tried fails to work, or throws and error for invalid expression.
{
"$and": [
{
"updateDescription.updatedFields.SubCategories.1.jumpsellerSubCategoryId": {
"$exists": false
}
},
{
"updateDescription.updatedFields.jumpsellerCategoryId": {
"$exists": false
}
}
]
}
I tried replacing the array depth of 0,1,2, etc with $
and that seems to be a valid expression in mongo but the filter does not work at all.