Skip to main content
MongoDB is available as an Available Now destination connector. MantrixFlow delivers only the published SQL model’s output through a custom dlt destination backed by PyMongo. Delivery uses bounded unordered bulk writes and removes internal dlt fields before documents reach the destination collection.

Required access

Use a dedicated writer scoped to the destination database:
The writer needs permission to read index metadata and insert or update documents. If your operating policy requires pre-created collections, validators, or indexes, create those with a separate administrative identity.

Connection fields

The complete URI is encrypted as one secret and masked after saving. URI query options such as authSource, replicaSet, and tls=true are passed to PyMongo.

Create the connection

  1. Open Connections.
  2. Click + New Connection.
  3. Set the role to Destination.
  4. Choose MongoDB.
  5. Enter the complete URI and destination database.
  6. Click Test Connection.
  7. Save after the test succeeds.

Prepare the collection

MongoDB can create a collection on the first write, but production deployments should normally create and review the collection, validator, and indexes first. Create a unique index for the selected Upsert key:
Without an index, Upsert remains correct but may perform poorly as the collection grows. MantrixFlow reports a warning when it cannot verify a supporting index.

Configure delivery

  1. Open Destinations and click Add destination.
  2. Choose the MongoDB connection and target database.
  3. Open Transformations, select the MongoDB destination, and create the SQL model.
  4. Save, validate, preview, and publish the revision.
  5. Set the published output target to database.collection, such as analytics.orders.
  6. Select one or more stable, non-null Upsert keys.
  7. Save the destination and run the pipeline.
The source and destination cannot be the same logical MongoDB database and collection in one pipeline.

Write behavior

The public MongoDB destination uses Upsert. Every output row must contain a non-null value for each selected merge key. Matching documents are updated; new documents are inserted.
  • _id is the default stable key for MongoDB-to-MongoDB pipelines.
  • A business identifier such as external_id can be used for SQL sources.
  • Internal fields whose names begin with _dlt are never written.
  • A rerun with the same keys updates existing documents instead of duplicating them.
Internal APPEND support exists for controlled runtime operations but is not advertised in the public UI. REPLACE is disabled because a portable atomic collection swap cannot be guaranteed.

Document limits and BSON mapping

Documents are BSON-encoded before network I/O. A document exceeding MongoDB’s 16 MiB limit is rejected with the collection and a bounded record identifier. Common SQL values map to BSON-safe strings, numbers, decimals, dates, binary values, arrays, and nested documents.

Verify delivery

The duplicate aggregation should return no rows. Compare the collection count with the run’s rows written value, accounting for transformation filters.

Current limitations

  • REPLACE and Change Streams are disabled.
  • Atlas, replica-set, sharded-cluster, and live TLS destination certification remains incomplete.
  • PostgreSQL-to-MongoDB and MongoDB-to-MongoDB have automated evidence. MySQL, ClickHouse, DuckDB, and manual UI pairings remain pending owner validation.

Troubleshooting

See MongoDB source and the MongoDB and PostgreSQL verified paths.