How to create custom trigger in mongoDB

Hello, I am working on a project where I want to have a custom trigger a collection when events like insert/update/delete happens currently we use oracle where it has support of triggers like after insert and with this we can insert record in different table(simple audit). same I want to build in monogDB where after insert/delete/update I want to add two values old value and new value in different collection. Is this possible?

Hi, you can achieve this through “Database Triggers” by implementing the logic in the trigger itself; or through the Realm-app you can create a function first & then have the trigger call this function each time a change event occurs.

This documentation should be helpful for getting started:
https://docs.mongodb.com/realm/triggers/database-triggers/
What Are Database Triggers? | MongoDB

Hi Dinok, yes have gone through this before to me it seems like sending notification to the user.
what I want is whenever a crud event occur who has done and change values are changed I need to store it in another document which will be my audit document so I can easily put filters to show history to the UI what is changed. when is changed.