MongoDB to MySQL: Nightly Reporting Rollup Template
A nightly Schedule trigger aggregates a MongoDB collection and writes the summarized rows into a MySQL reporting table for your BI tools.
What It Builds
This template uses a Schedule trigger to run every night on a cron expression in your timezone. A Connector node on MongoDB runs an aggregation over your source collection to produce daily rollup rows (counts, sums, and grouped totals). A second Connector node on MySQL inserts those summarized rows into your reporting table, where dashboards and BI tools can read them without touching the raw documents. The result is a clean, pre-aggregated table that refreshes on its own each night.
The Prompt
Paste this into Spojit's Miraxa and it builds the workflow, connecting the tools for you:
Build a workflow that runs every night at 2am Australia/Sydney time on a Schedule trigger. Use a MongoDB Connector node to aggregate the "orders" collection into daily rollup rows grouped by day, with the order count and total revenue for each day. Then use a MySQL Connector node to insert those summarized rows into a "daily_sales_rollup" reporting table so our BI tools can read them.
Connectors Used
- Schedule trigger - fires the workflow on a nightly cron in your chosen IANA timezone.
- MongoDB - a Connector node aggregates the source collection into summary rows.
- MySQL - a Connector node inserts the rollup rows into your reporting table.
Customize It
Change the cron time and timezone, the source collection and target table names, the grouping window (hourly, weekly), and which metrics you sum or count. Point the aggregation at a different field to roll up by store, product, or region instead of day.
Tips
- Keep both nodes in Direct mode: the aggregation and insert are deterministic and cost no AI credits.
- Confirm your MySQL connection has insert rights on the reporting table, and add a unique key so re-runs do not duplicate a day's row.
- Set the timezone to where your reporting day boundary lives so totals line up with how your BI tools expect them.
Related
- Want the step-by-step? See How to Build a MySQL to MongoDB Data Pipeline.
- How to Sync Shopify Data to MySQL for Reporting.
- Setting Up a Schedule Trigger.