What is the difference between MongoDB Realm Triggers and MongoDB Atlas Triggers?

1.9k views Asked by At

So both of them are part of MongoDB features that I think have common nature. In my case, every time a document is created or updated, it will trigger a function that will update the document field with Date.now() timestamp.

It can be achieved using a trigger, but there are 2 ways to do it, and I am not sure which one is suitable to choose. What is the difference between MongoDB Realm Trigger and MongoDB Atlas Trigger? Advantages over each other?

Thank You

1

There are 1 answers

1
Tom Slabbaert On BEST ANSWER

They are inherently similar. The best way to think of it is two different GUI's that uses the same(ish) backend code. Apart from authentication triggers that only exist on realm the other two types both work in similar ways.

They are both "triggered" by the same event (type) wether it be a cron expression or a database event and they both execute a realm based function (either pre-saved in realm or saved on the trigger in atlas. So the only actual difference comes from the configuration options, for example:

  1. atlas trigger can connect to multiple clusters while realm must choose a single one.
  2. realm has a project option available.
  3. realm accepts a function name (as it's already saved) while atlas requires the actual code saved. (If for some reason you want the same code executing for different triggers realm is more stable as updating 4 different triggers due to code change is not fun)

You can compare the confirguration options yourself here for realm and here for basic trigger

I have personally haven't noticed a difference between the two (nor did I look that deep into it), I feel that Apart from inside knowledge from an engineer in Mongo that can spill the beans whether or not there's an actual performance different or if both triggers use the same code base there is not much to say on the subject.