How to create trigger from node JS application

Is there any way to create trigger from nodeJS application in MongoDB Atlas instead of creating them from atlas.
for example: we define model in node app and when we run the app, model will be created automatically in atlas if not exist.
I want same thing in trigger.
I want to define trigger using node app instead of defining it using MongoDB atlas

You might want to take a look at

Ya I explored this also. the problem is I’m implementing change stream in sails JS
for that there is no reference documents available.
Here is the code that I have wrote for the change stream in sailsJS but it says watch() is not defined

const pipeline = [
        $project: { documentKey: false }
    try {
      var db = sails.getDatastore().manager.client;
      var collection = db.collection('user');
      const changeStream =;
      changeStream.on("change", function(change) {
    } catch (err) {

Looking forward to get some insights

@steevej can you please help me out

No need to ask for my help explicitly. I look at the forum when I have time and I answer when I can. If I did not answer to your previous post it is because I have absolutely no clue about sailsJS. And writing that I have no clue about sailsJS would have been a useless post that other people would waste time reading. When I do not follow or answer, it is because I do not know or I am not available.