Portal Community

Common Properties (All Operations)

PropertyRequiredDescription
credential_idRequiredReference to a MongoDB connection credential stored in BizFirst Credentials Manager. The credential holds the full connection string including authentication and cluster hostname.
resourceRequiredThe resource type to operate on. Use document for collection CRUD and aggregation, or search-index for Atlas Search index management.
operationRequiredThe operation to perform within the selected resource. See per-operation sections below.
databaseRequiredThe MongoDB database name. Supports BizFirst expressions for dynamic database selection (e.g. {{ vars.tenant_db }}).
collectionRequiredThe MongoDB collection name. Supports expressions.

find — Properties

PropertyRequiredDescription
filterRequiredMongoDB query filter as a JSON object. Use standard MongoDB query operators: $eq, $gt, $lt, $in, $and, $or, $regex, etc. Supports BizFirst expressions within filter values.
projectionOptionalFields to include or exclude in the response. Use {"field": 1} for inclusion and {"field": 0} for exclusion. Cannot mix inclusion and exclusion (except for _id).
sortOptionalSort order as a JSON object. Use 1 for ascending and -1 for descending. Example: {"created_at": -1}.
limitOptionalMaximum number of documents to return. Default: no limit. For performance, always set a limit when the result set may be large. Supports expressions.
skipOptionalNumber of documents to skip before returning results. Use with limit to implement pagination.
// find — example configuration
{
  "credential_id": "mongodb-atlas-prod",
  "resource": "document",
  "operation": "find",
  "database": "ecommerce",
  "collection": "orders",
  "filter": {
    "customer_id": "{{ vars.customer_id }}",
    "status": { "$in": ["pending", "processing"] },
    "created_at": { "$gte": "{{ vars.date_from }}" }
  },
  "projection": { "order_id": 1, "status": 1, "total_amount": 1, "created_at": 1, "_id": 0 },
  "sort": { "created_at": -1 },
  "limit": 50
}

insert — Properties

PropertyRequiredDescription
documentOptionalA single document object to insert. Use this when inserting one record. Supports BizFirst expressions throughout the document structure.
documentsOptionalAn array of document objects for bulk insertion. Use this to insert multiple records in a single operation. Either document or documents must be provided.
// insert — single document example
{
  "credential_id": "mongodb-atlas-prod",
  "resource": "document",
  "operation": "insert",
  "database": "audit",
  "collection": "workflow_runs",
  "document": {
    "workflow_id": "{{ workflow.id }}",
    "triggered_by": "{{ vars.user_email }}",
    "started_at": "{{ workflow.started_at }}",
    "input_payload": "{{ vars.input_payload }}",
    "status": "completed",
    "duration_ms": "{{ vars.duration_ms }}"
  }
}

update — Properties

PropertyRequiredDescription
filterRequiredSelects which documents to update. Uses the same query syntax as find. Provide a precise filter to avoid unintended bulk updates.
updateRequiredThe update specification using MongoDB update operators. Common operators: $set (set field values), $push (append to array), $inc (increment), $unset (remove field), $addToSet (add to array without duplicates).
upsertOptionalIf true, insert a new document when no document matches the filter. Default: false.
multiOptionalIf true, update all matching documents. If false (default), update only the first matching document.
// update — order status update example
{
  "credential_id": "mongodb-atlas-prod",
  "resource": "document",
  "operation": "update",
  "database": "ecommerce",
  "collection": "orders",
  "filter": { "order_id": "{{ vars.order_id }}" },
  "update": {
    "$set": {
      "status": "{{ vars.new_status }}",
      "updated_at": "{{ now() }}",
      "last_updated_by": "{{ vars.processor_name }}"
    },
    "$push": {
      "status_history": {
        "status": "{{ vars.new_status }}",
        "changed_at": "{{ now() }}",
        "changed_by": "{{ vars.processor_name }}"
      }
    }
  },
  "upsert": false,
  "multi": false
}

delete — Properties

PropertyRequiredDescription
filterRequiredSelects which documents to delete. Must not be an empty object {} — BizFirst blocks empty-filter deletes to prevent accidental collection wipes.
delete_manyOptionalIf true, delete all documents matching the filter. If false (default), delete only the first matching document.

find-one-and-update — Properties

PropertyRequiredDescription
filterRequiredQuery to select the document to update.
updateRequiredUpdate specification using MongoDB update operators.
return_documentOptionalWhich document to return. "before" returns the document as it was before the update (default). "after" returns the document as it is after the update.
upsertOptionalInsert if no match found. Default: false.
sortOptionalWhen multiple documents match, sort determines which one is selected. Example: {"priority": -1} picks the highest-priority document.

aggregate — Properties

PropertyRequiredDescription
pipelineRequiredAn array of aggregation stage objects. Each stage is a JSON object with a single key that is the stage operator ($match, $group, $lookup, $project, $sort, $limit, $unwind, $search, etc.). BizFirst expressions are supported in stage values.
// aggregate — daily revenue by product category
{
  "credential_id": "mongodb-atlas-prod",
  "resource": "document",
  "operation": "aggregate",
  "database": "ecommerce",
  "collection": "orders",
  "pipeline": [
    { "$match": { "status": "completed", "order_date": { "$gte": "{{ vars.period_start }}", "$lte": "{{ vars.period_end }}" } } },
    { "$unwind": "$line_items" },
    { "$group": {
        "_id": "$line_items.category",
        "total_revenue": { "$sum": "$line_items.subtotal" },
        "order_count": { "$sum": 1 },
        "avg_order_value": { "$avg": "$line_items.subtotal" }
    }},
    { "$sort": { "total_revenue": -1 } },
    { "$project": { "category": "$_id", "total_revenue": 1, "order_count": 1, "avg_order_value": 1, "_id": 0 } }
  ]
}

Search Index Operations — Properties

PropertyRequiredDescription
index_nameRequiredThe Atlas Search index name. Required for create, update, and drop operations.
index_definitionOptionalThe index mapping definition as a JSON object. Required for create and update. Specifies analyzers and field mappings for full-text and vector search.
Expression Support: All string-typed property values support BizFirst expression syntax using double curly braces: {{ expression }}. This enables dynamic database names, collection routing, filter values, and even dynamic pipeline stages at runtime. Use {{ vars.field }} for workflow variables, {{ env.VAR }} for environment variables, and {{ now() }} for the current timestamp.
Performance Note: Always include a limit on find operations targeting large collections. For production workloads, ensure query filters use indexed fields. Use the aggregate pipeline with $match as the first stage to leverage indexes before any transformation stages.