Triggers on a collection not firing except on one field change

I’m really puzzled by something that feels like it must be super basic or an oversight on my part. I’ve created triggers on a collection, no match filter, and set to fire on insert, update, delete, and replace. They are getting fired, but only on changes to a last updated timestamp field we periodically update. They are not getting fired when I change a document in the collection in other ways, including manually in the atlas collection viewer/editor or via our other existing code paths besides the timestamp update.

When I first came across the issue, I tried to simplify and recreate the problem and think I have a minimal example. I made a function trigger that does nothing but log the change event ( console.log("Change event is: ", JSON.stringify(changeEvent));). All I get are update type changes on the single timestamp field I mentioned.

I expect unrelated, but I also noticed that I can’t create or edit a function to set “Skip Events on Re-Enable” to on. It won’t save - gives a “json: cannot unmarshal object into Go struct field dbConfigData.skip_catchup_events of type bool” error when saving.

Any thoughts? I’m happy to share more, but there’s just not much in the trigger. Feels like something else in the collection is getting in the way of trigger firing, but I don’t know where to go from here.

Hi, can you send the URL for your realm application? It will look something like this:
https://realm.mongodb.com/groups/610932e76ef44e5b35860fd3/apps/615184b60d69430515e10ebc. This is safe to send as employees have access to look at it.

https://realm.mongodb.com/groups/61f3ff816709e7673f97eaae/apps/622e8d0f8fd89c14fdd8b46c

The trigger named, appropriately enough, “trigger_test” should be fine to look at.

I am not seeing any database or collection set. Does something show up there for you?

Yes, it’s filled in appropriately with the db name and collection. Not sure why it didn’t populate for you, but I don’t understand how the permissions would work for Mongo employees. Can DM if you wish - wouldn’t think it’d be good to show our specific details. Same behavior with both triggers in the app btw.

Thanks so much for looking at this. I appreciate how fast you responded and your help.

For sure. Feel free to DM me or email me at tyler.kaye@mongodb.com. Triggers are pretty well tested and I cant reproduce this on my own so I suspect that its just something odd with the setup. How are you changing the document such that events are not generated? Note that if the document doesnt actually change, then an event will not fire

Thanks, email sent. I promise to update here with whatever is figured out in order to help the next person.

I am now getting the triggers. I believe the issue was pilot error. I think when I first saw the issue, it was due to missing many triggers due to a long execution time and timeout of the function blocking many of the calls. Once that was fixed, I think I missed the relatively few test changes I made due to the number of backed up timestamp changes.