How to Export BigCommerce Orders to MongoDB
Store BigCommerce order data in MongoDB for flexible analytics and reporting.
What This Integration Does
BigCommerce's reporting is fine for dashboards inside the platform, but the moment you want to join orders with marketing spend, warehouse data, or your own customer model, you need a copy of the orders outside BigCommerce. MongoDB is a natural fit: orders are nested documents, the shape evolves over time, and your analysts will want to query freely without sticking to a fixed schema.
The workflow runs on a schedule, pulls orders updated since the last run, normalizes them lightly, and upserts them into a MongoDB collection. Because BigCommerce order IDs are stable, re-running a sync window is safe: the same order gets overwritten in place, not duplicated.
Prerequisites
- A BigCommerce connection with read access to the Orders API (V2 store_v2_orders_read scope or equivalent).
- A MongoDB connection (Atlas or self-hosted) with write access to your target database.
- A target database (e.g.
bc_mirror) and a collection per entity (orders,customers,products).
Step 1: Schedule Trigger
Drop a Trigger node and set its type to Schedule. Every 15 minutes works for stores under a few thousand orders a day; hourly is plenty for most. The trigger surfaces the previous run timestamp, which the next step uses to scope the API call.
Step 2: Variable - Compute the Sync Window
Add a Variable assignment for the window:
syncStart- the previous run's timestamp, or 24 hours ago on the first run.syncEnd- the current timestamp.
BigCommerce's min_date_modified filter is exclusive on the lower bound, which is what you want so consecutive runs don't double-count edge cases.
Step 3: Fetch Orders from BigCommerce
Add a Connector node pointing at the bigcommerce connector and pick the list-orders tool. Configure:
- min_date_modified:
{{ syncStart }} - max_date_modified:
{{ syncEnd }} - limit:
250(the BigCommerce max per page)
If the result count equals 250, more pages exist - the next step handles that.
Step 4: Loop Over Pages
Wrap the fetch in a Loop set to While with the condition {{ lastPage.length }} === 250. Increment a page variable each iteration and pass it as the page param to list-orders. Collect every page's results into a single allOrders array. Stop when a page returns fewer than 250 rows.
Step 5: Transform - Shape for MongoDB
Add a Transform node to prepare documents:
- Set
_idto the BigCommerceidso upserts are idempotent. - Parse
date_createdanddate_modifiedfrom BigCommerce's RFC 2822 format into ISO 8601 (analysts will thank you). - Add
syncedAtwith the current timestamp so dashboards can show data freshness. - Optionally use the json connector with
pickto drop fields you'll never query.
Step 6: Upsert to MongoDB
Wrap the next step in a Loop over the transformed orders. Inside the loop, add a Connector node for the mongodb connector and pick the update-documents tool:
- Database:
bc_mirror - Collection:
orders - Filter:
{ "_id": "{{ order._id }}" } - Update:
{ "$set": {{ order }} } - Upsert:
true
After the loop, route to a slack send-message step with a summary ("Synced 1,243 orders, 0 errors") so you have a heartbeat that the job ran.
Tips
- Index
date_modifiedandcustomer_id- the two fields analysts will almost always filter on._idis indexed automatically. - Pull order line items separately - BigCommerce returns orders without line products. Add a second pass using
raw-api-requestto call/orders/{id}/productsif you need them. - Backfill once - on first deploy, run the workflow once with
syncStartset to your store opening date. After that, incremental runs are quick.
Common Pitfalls
- Rate limits - BigCommerce caps API requests per second per store. If you upsert 1,000 orders in a tight loop, you'll hit the ceiling. Add a small delay or use Spojit's per-node concurrency cap.
- Order status changes - BigCommerce updates
date_modifiedwhen status changes (e.g. shipped, refunded). Your mirror reflects the latest state, not a point in time. If you need history, append to a secondorder_eventscollection. - Timezone on dates - BigCommerce returns timestamps in the store's timezone, not UTC. Convert explicitly or your window filters drift across DST.
Testing
Set syncStart manually to one hour ago and run the workflow once. Open MongoDB Compass (or your tool of choice) and check a few documents: are _id and the parsed dates correct? Compare the count to the BigCommerce admin filtered to the same window. If both match, turn the schedule on.