Using Stitch triggers to call React application processing

Hi,

My overall goal for this post is to figure out how I can implement a trigger that will be called when an insert is performed on one of my collections, and when that trigger is fired, it should have my REACT application do some processing on the data that was inserted.

  1. I don’t know if what I want to do is even possible - ??

  2. I have set up a trigger on my DB and used the default “commented out” function in the Edit Trigger page.

  3. I have read the following:
    https://docs.mongodb.com/stitch/triggers/database-triggers/
    https://docs.mongodb.com/manual/reference/change-events/#insert-event
    https://docs.mongodb.com/stitch/triggers/trigger-snippets/

The last one showing the trigger snippets seems like it’s getting close to what I want to do… but instead focuses on sending text messages via twilio and new user authentication… instead of having the application do some processing like I would like it to.

Thanks
Mike

I have code in place in my app that will insert data into the table associated with the trigger.

I have executed that code and see that the trigger is firing. Here is an excerpt from the trigger log:

garminPushNotification
Database
OK
2020-04-10T15:23:01-07:00
4ms
5e90f1c5d1e388afc4f82479

Any body have any idea on this?

Hi Michael – If you want your React application to do the processing instead of a Function, I think you will want to use the Watch() functionality instead of Triggers. While both are based on MongoDB’s Change Streams Triggers are meant solely for calling Stitch Functions, while Watch() is meant to be used within an application to monitor for and react to changes – Is this what you’re looking for?

1 Like

Drew,

Thanks… that helps out !

Hi @MLiss,
I have the same need but for a Flutter app.
By any chance have you managed to implement this ?
Would you have a minute to spare for a quick feedback ?
I read about the integration with Realm db,
I wonder if this means that using a mobile Realm db improves integration for such features.