{
  "name": "mongodb-query",
  "title": "Run a MongoDB find",
  "category": "Databases",
  "tags": [
    "databases",
    "mongo"
  ],
  "version": "1.0.2",
  "date": "2026-10-19",
  "notes": "Repin mongo:7 on the tag's current digest. What is still open against it is recorded in hack/image-cve-exceptions.txt. Same tool, same arguments; nothing about what the step runs changes.",
  "latest": true,
  "installable": true,
  "url": "https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2.json",
  "templateUrl": "https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml",
  "entrypoint": "query",
  "parameters": [
    {
      "name": "collection",
      "title": "Collection",
      "description": "Collection to query.",
      "type": "string",
      "required": true
    },
    {
      "name": "database",
      "title": "Database",
      "description": "Database name to run the query against.",
      "type": "string",
      "required": true
    },
    {
      "name": "filter-json",
      "title": "Filter (JSON)",
      "description": "MongoDB find() filter as a JSON document.",
      "type": "string",
      "required": false,
      "default": "{}",
      "example": "{\"status\": \"active\"}"
    },
    {
      "name": "uri-secret-key",
      "title": "URI secret key",
      "description": "Key within the Secret that holds the connection URI.",
      "type": "string",
      "required": false,
      "default": "uri"
    },
    {
      "name": "uri-secret-name",
      "title": "URI secret name",
      "description": "Name of the Kubernetes Secret holding the full connection URI (including any credentials).",
      "type": "string",
      "required": false,
      "default": "mongodb-uri"
    }
  ],
  "images": [
    {
      "ref": "mongo@sha256:8bb4442761a63a8dda452744082cdac9644b429807eb977b42324a63cef59ca4",
      "repository": "mongo",
      "digest": "sha256:8bb4442761a63a8dda452744082cdac9644b429807eb977b42324a63cef59ca4"
    }
  ],
  "install": {
    "kubectl": "kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml",
    "argo": "argo template create -n argo https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml"
  },
  "template": "apiVersion: argoproj.io/v1alpha1\nkind: WorkflowTemplate\nmetadata:\n  name: mongodb-query\n  labels:\n    dagweave.io/catalog-item: mongodb-query\n  annotations:\n    # The catalog semver this manifest was authored at. The dagweave app records\n    # (catalog-item-id, semver) -\u003e content-hash -\u003e base-vN when it mints the tenant\n    # cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.\n    dagweave.io/catalog-version: \"1.0.2\"\n    dagweave.io/catalog-category: \"Databases\"\nspec:\n  entrypoint: query\n  templates:\n    - name: query\n      inputs:\n        parameters:\n          # Database name to run the query against.\n          - name: database\n          # Collection to query.\n          - name: collection\n          # MongoDB find() filter as a JSON document. Defaults to all documents.\n          - name: filter-json\n            default: \"{}\"\n          # Name of the Kubernetes Secret holding the full connection URI (including\n          # any credentials), e.g. mongodb+srv://user:pass@host/. Defaults let a user\n          # leave them blank in the Inspector.\n          - name: uri-secret-name\n            default: mongodb-uri\n          - name: uri-secret-key\n            default: uri\n      container:\n        # Pinned by digest per the catalog convention: an image rebuild can never\n        # silently change the behaviour of an already-released item version.\n        # mongo:7 (ships the mongosh shell)\n        image: mongo@sha256:8bb4442761a63a8dda452744082cdac9644b429807eb977b42324a63cef59ca4\n        command: [sh, -c]\n        # The URI (with creds), database, collection and filter are all passed as env\n        # vars (below), never interpolated into the shell or the JS eval, so values\n        # containing quotes or shell metacharacters are safe. mongosh is Node-based so\n        # the eval reads them from process.env; the filter is parsed with JSON.parse.\n        args:\n          - |\n            set -eu\n            mongosh \"$MONGO_URI\" --quiet --eval '\n              db.getSiblingDB(process.env.DB_NAME)\n                .getCollection(process.env.COLL)\n                .find(JSON.parse(process.env.FILTER))\n                .toArray()\n            '\n        env:\n          - name: DB_NAME\n            value: \"{{inputs.parameters.database}}\"\n          - name: COLL\n            value: \"{{inputs.parameters.collection}}\"\n          - name: FILTER\n            value: \"{{inputs.parameters.filter-json}}\"\n          - name: MONGO_URI\n            valueFrom:\n              secretKeyRef:\n                name: \"{{inputs.parameters.uri-secret-name}}\"\n                key: \"{{inputs.parameters.uri-secret-key}}\"\n",
  "templateSha256": "913ccc97be2d0fb3fb6678788c31cedf1e91b74973b329dfedb85b377bf164d3",
  "source": "https://github.com/dagweave/catalog/tree/67458f74dbbf913b03177f3cefc69424be85eb1d/catalog/mongodb-query",
  "catalogSha": "67458f74dbbf913b03177f3cefc69424be85eb1d"
}
