XML to MongoDB: FTP Feed Loader Template

A Schedule trigger pulls an XML product feed from FTP, converts it to JSON, and loads every record into a MongoDB collection on a fixed cadence.

What It Builds

This Spojit template runs on a Schedule trigger. At each scheduled time it uses a Connector node on the ftp connector to download an XML feed file, a Connector node on the xml connector to convert that XML into JSON, and a Connector node on the mongodb connector to insert the parsed records into a collection. The result is a hands-off feed loader that keeps a database table in step with a supplier or legacy system that only publishes flat files.

The Prompt

Paste this into Miraxa, the intelligent layer across your automation, and it builds the workflow, connecting the tools for you:

Build a workflow on a Schedule trigger that runs every morning at 6am Australia/Sydney time. Download the file feeds/products.xml from my FTP connection, convert that XML into JSON with the xml connector, then insert each product record into the "products" collection in my MongoDB connection. Log how many records were loaded.

Connectors Used

  • Schedule trigger - fires on a 5-field cron and timezone (for example 0 6 * * * in Australia/Sydney); a single trigger can hold several schedules.
  • ftp - download-file retrieves the XML feed from the remote path; list-directory helps you confirm the file name first.
  • xml - to-json turns the downloaded XML into a JSON structure you can map; parse and extract help when the feed is deeply nested.
  • mongodb - insert-documents writes the records into your collection; update-documents is the choice if you need upserts instead.

Customize It

Change the cron expression and timezone to match how often the feed updates, and point the file path at your own feed (for example feeds/inventory.xml). Swap the target collection name to suit your schema. If your feed should refresh existing rows rather than append, tell Miraxa to use update-documents as an upsert keyed on your product ID instead of insert-documents, so re-runs do not create duplicates.

Tips

  • Use the ftp connector node in Direct mode for the download and the mongodb node in Direct mode for the insert: these are predictable single-tool calls, so they cost no AI credits and run deterministically.
  • XML feeds often wrap records in a single root element. Map the array under that root (for example {{ feed_json.products.product }}) and feed it to insert-documents so each entry becomes its own document.
  • Add a unique index on your product ID in MongoDB and use update-documents as an upsert when the feed is a full snapshot rather than a delta, so a daily re-run keeps the collection clean.

Common Pitfalls

  • The Schedule trigger uses a 5-field Unix cron plus an IANA timezone. A wrong timezone is the most common reason a feed loads at the wrong hour: set it explicitly (for example Australia/Sydney) rather than assuming server local time.
  • If the FTP file is not ready when the workflow runs, download-file returns nothing useful. Schedule the run after the feed is reliably published, or call get-file-info first to check the file exists before downloading.
  • Large feeds can hold thousands of records. Insert in batches with insert-documents rather than one document per call, and watch the run time so a single execution does not balloon.

Related

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.