Firing a trigger if the added or updated document has a field with specific value
Sometimes a trigger needs to be fired only if the added or updated document has a specific value for a field.
For example, let's say we want to hit one of our endpoints that is responsible for sending push notification only if the user is not currently logged in the app on his machine or phone.
We can't account for this situation using a match expression since we are not interested in the change of values, but what the value is after the document update or insert occurred.
Without this functionality, the trigger will be fired anyways and then we have to check in the associated function if the value in the "Full Document" meets our criteria. Even though the function will not run, but the trigger is fired every single time which is not desirable.
So, long story short, it would be nice if we had access to the inserted or updated "full document" in the advanced section of a trigger inside the Realm UI, not only in the function that's associated with the trigger.
Declining as this is already present. Thanks for updating Akbar.
-
Akbar commented
It appears this feature already exists and we can access fullDocument in the Realm UI.