Mongodb Realm Functions Vs Atlas Triggers? whats the difference?

Recently watched an awesome video by Michael Lynn on youtube Create a Data Enabled API in 10 Minutes with MongoDB Realm - YouTube, but cant find him here in this community.

I have some questions hope someone can help.

  1. What is the difference between mongodb atlas triggers and mongodb realm functions…
    Seems there is a lot of overlap? Both are functions as a service, the former doesn’t seem to allow for HTTP triggers and only database triggers and crob jobs. VS realm does.
  2. Are realm and triggers functions globally distributed? i could not find this information
  3. Can I customize HTTP trigger domain names for realm? Currently, the default webhook URL is webhooks.mongodb-relam/api.xxxx
  4. What are the limits of the functions? and charges? are these all aws lambda functions behind the scenes?

Thank you.

Hi @Rishi_uttam, I’ll try to answer your questions…

  1. A Realm Trigger is a way to automatically invoke a Realm Function.
  2. When you create a new Realm app, you can open the advanced configuration settings and select whether the app should be global or local to a specific region
  3. Not that I’m aware of
  4. No, Realm functions aren’t using Lambda. They’re lighter weight than Lambda and designed to be run frequently. You can find pricing details here… https://docs.mongodb.com/realm/billing/

Hi Andrew, thanks that does clear up a little.

I have set my realm app set to Global, but writes are restricted to one location (currently Singapore) . Does this mean that all reads from my app (including functions & HTTP functions) are read form the database that is served from atlas edge locations? thats great, then they dont need to route back the write origin. Are realm locations the same as Atlas locations?

My mongob database with atlas is hosted on Azure (Hong Kong region) but realm database writes are in Singapore… ??. but my app is using the same collection in the same database? if you could point me to a document to explain why the realm database is different form the atlas database that may help to claify things? i know many of us are confused about this point.

Thanks.

Great Questions!

  1. Triggers are functions that have special hooks. That’s the main difference… you can specify that the code in your trigger function gets executed whenever a document is added, updated, or removed. There seems to be overlap for sure… but it’s just in the functionality around the triggered action.
  2. Not sure I know what you mean? Triggers and functions are attached / connected to a specific Atlas Database. What is your concern around distribution of the trigger or function?
  3. No - you can’t add a custom domain to an api call to my knowledge. This shouldn’t be exposed as an user-facing end-point… you typically reference those api calls in your code. Curious why you would want to add a custom domain?
  4. MongoDB Realm applications (functions, triggers included) are billed according to how much they’re used on a monthly basis. There are four independently-measured usage types that determine how much you pay each month… more information is available here: https://docs.mongodb.com/realm/billing/

I hope this helps!

Whoops - looks like @Andrew_Morgan already answered.

Nice.

  1. in my client side app, i am making fetch calls to realm http 3rd party http triggers so the user does see the xhr origin in the browser status bar, was hoping to put it under our domain (like you do in lambdas)

  2. Realms global reads i believe are in 4 locations currently, and writes are in 1. I seek low latency like everyone else hence its good that reads are automatically routed to the closet destination out of the 4 current locations.

  3. noted on the pricing thanks.

  4. Im still struggling with using a function to create a new user based on a incoming post request body’s username and password. I know realm functions get a context object, but where is the context.emailPasswordAuth.registerUser(email, password); do i need to import the realm node sdk in to the function? seems like i shouldn’t have to just like i dont need to import the mongodb module., its available in the context. coulnd’t find much in the documentation on this… thanks for your help.