Browse the docs
Output node

MongoDB output

Write rows into a MongoDB collection as documents. Turn on All or nothing and a replace that fails leaves the old collection in place.

Category
Output
Connection
MongoDB

What it does

Writes the incoming rows into a MongoDB collection, one document per row (each column becomes a field). Appends, replaces (drops the collection first), or upserts (replaceOne on the key field, so re-runs overwrite rather than duplicate).

Inputs and outputs

InputsOne.
OutputsNone. This node ends a pipeline.

When to use it

  • Push computed data back into an application's MongoDB
  • Refresh a collection each run (replace)
  • Idempotently merge by a key (upsert)

Examples

Append

Collection: sales.orders, Mode: append

Full refresh

Mode: replace

Drops the collection first, then inserts.

Upsert

Mode: upsert, Key field: order_id

Match on order_id; insert new, overwrite existing.

Tips

  • Credentials live on the Connection, never in the pipeline.
  • Upsert keyed on a field makes a pipeline safely re-runnable, with no duplicates. Every row needs a value in that field: a row with an empty key fails the run, naming the row, because it would overwrite whichever document lacks the field. Filter or fill empty keys upstream.
  • The collection is created on first write; Replace drops it (and its indexes) first.
  • Dates and decimals are written as real BSON types, so they sort and query as dates and money in Mongo. A date-only value becomes midnight UTC (BSON has no date-only type), and a time-of-day stays text.
  • All or nothing (off by default, replace only): on, Replace writes into a new collection beside the old one and renames it into place at the end, so a failure leaves the old collection untouched; off, Replace drops the collection before reading anything. Append and upsert write document by document either way.