Skip to main content

MongoDB integration

Find, insert, update, upsert, and delete documents in a client's MongoDB database from inside a workflow.

What it does

The MongoDB integration lets your agency read and write a client's MongoDB database directly from a workflow. Connect the database once with a connection string or discrete host, port, user, password, and database, and your workflows can find documents by a filter, insert a document, update or delete documents by a filter, and upsert a document. Connection details are encrypted at rest, filters and updates are passed as queries rather than evaluated as code, and results are capped so a large read cannot overwhelm a run.

Connect a MongoDB database

  1. Open your workspace in TaskJuice and add a MongoDB connection on the node that uses it.
  2. Paste a connection string, for example mongodb+srv://user:password@cluster.example.net/appdb. Connection-string mode preserves SRV records and replica-set options.
  3. Or fill in the host, port (27017 by default), user, password, and database separately.
  4. Save the connection. The password and connection string are stored encrypted and are never shown again or written to run output.

Provision a least-privilege database user scoped to the collections the workflow touches, and expose the database on a public host the workflow can reach over TLS. Private and internal addresses are blocked.

Actions

  • mongodb/find returns the documents matching a filter, with optional projection, sort, and limit.
  • mongodb/insert inserts a single document and returns its generated id.
  • mongodb/update updates the documents matching a filter with an update document such as { "$set": { … } }, returning the matched and modified counts.
  • mongodb/upsert updates a matching document or inserts it when none matches, returning the upserted id when one was created.
  • mongodb/delete deletes the documents matching a filter and returns the deleted count.

Write a safe filter

Pass filters and updates as objects; they are sent to the database as queries, never run as JavaScript:

filter: { "status": "active", "createdAt": { "$gt": "2026-01-01" } }
update: { "$set": { "status": "archived" } }

The $where, $function, and $accumulator operators, which would run server-side JavaScript, are rejected anywhere in a filter or update.

Known limitations

  • The find action returns at most 1,000 documents and around 5 MB per call; when a read is clipped the result sets truncated to true. Pass a limit and a selective filter to keep reads bounded.
  • An operation that runs longer than 30 seconds is cancelled by the database via maxTimeMS.
  • Connections are short-lived: each action opens and closes its own client.
  • Change streams (reacting to new or changed documents) are not part of this integration; it provides read and write actions only.
Was this helpful?