Mongodb – Periodic aggregations on MongoDB Atlas

mongodbmongodb-atlas

I have been developing a solution that uses MongoDB Atlas (currently M0) for storage. As I would need to provide some statistics throughout different time periods, I need to run periodic aggregations on hourly, daily, weekly, and monthly basis.

As the project is still small, I would prefer not to deploy Spark engine and not upgrade to higher Tier with map reduce functionalities. Considering this, I would be glad for any advice about how to periodically aggregate the raw documents.

Best Answer

MongoDB Stitch triggers enable you to execute application and database logic automatically, either in response to events or based on a pre-defined schedule.

As per MongoDB official documentation, Stitch supports three types of triggers:

Database triggers, which can automatically respond when documents are added, updated, or removed in a linked MongoDB collection.

Authentication triggers, which execute additional server-side logic when a user is created, authenticated or deleted.

Scheduled triggers, which execute functions at regular intervals according to a pre-defined schedule.

The Scheduled triggers may help you in achieving your expected behavior.

enter image description here