Company
Date Published
Author
Pavel Duchovny
Word count
900
Language
English
Hacker News points
None

Summary

The text discusses the concept of Automatic Refresh of Materialized Views in MongoDB, specifically how to use MongoDB Atlas Triggers to achieve this. The author proposes a solution that utilizes Scheduled Triggers to run a function every 5 minutes, which queries all needed materialized views from a configuration collection, builds an execution array of $merge commands, and runs them in parallel using Promise.all. This allows for the automatic refresh of Materialized Views according to configured pipelines in a MongoDB cluster. The solution is flexible and dynamic, enabling users to classify their mviews with different configurations consumed at different time intervals with dedicated triggers.