Create Scheduled Trigger using Atlas Charts Data source

Hi,

How can I create a scheduled trigger based on aggregation pipeline in Atlas → Charts → data source?

I have multi stage aggregation pipeline that I need to execute on a daily basis to populate a collection (MV).

While creating a Scheduled Trigger, I see that there is a LINK button that says “Link Data Source(s)” but it does not allow me to select a data source, it just allowed me to link the cluster. Am I doing something wrong?

Any help or advice is greatly appreciated.
Thanks in Advance.

Vidya

Hi @Vidya_Swar -

The “data source” term is a bit overloaded… in Charts it refers to a specific collection, but in App Services and Triggers it refers to the cluster.

If you want to refresh a materialised view via a trigger, there is a tutorial for this at How to create and manage Mongo DB Materialized Views using triggers. | by Boni Gopalan | Medium

Tom

1 Like

Thanks a lot for your time to bring clarity to my questions Tom, much appreciate it. Wish I could actually link DataSource (with my heavy aggregation pipeline code in it) and be able to schedule it. Hope MongoDB builds this feature. Am more of a T-SQL and PL-SQL programmer and less of object oriented programmer now teaching myself this powerful MongoDB. So was hoping that the aggregation-pipeline (stored procedure) could be scheduled.

Using database trigger will cost a lot as we get millions of records monthly.
So, I did try to schedule a heavy aggregation pipeline code into MV including Spirits in the Materialized View: Automatic Refresh of Materialized Views | MongoDB Blog. But I keep getting undefined error in the scheduled trigger and I cannot see the detailed error message.

Best regards and have a great week ahead.
Vidya