Run a MongoDB find
Run a find() query against a MongoDB collection with mongosh, using a connection URI (with credentials) read from a Kubernetes Secret.
Install v1.0.2
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml
Facts
- Category
- Databases
- Tags
- databases mongo
- Entrypoint
query- Template SHA-256
913ccc97be2d0fb3fb6678788c31cedf1e91b74973b329dfedb85b377bf164d3- Source
- mongodb-query at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
mongo | none recorded | sha256:8bb4442761a63a8dda452744082cdac9644b429807eb977b42324a63cef59ca4 |
Parameters
| Name | Description | Default |
|---|---|---|
collection required |
Collection to query. | none |
database required |
Database name to run the query against. | none |
filter-json |
MongoDB find() filter as a JSON document. Example {"status": "active"} |
{} |
uri-secret-key |
Key within the Secret that holds the connection URI. | uri |
uri-secret-name |
Name of the Kubernetes Secret holding the full connection URI (including any credentials). | mongodb-uri |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: mongodb-query
labels:
dagweave.io/catalog-item: mongodb-query
annotations:
# The catalog semver this manifest was authored at. The dagweave app records
# (catalog-item-id, semver) -> content-hash -> base-vN when it mints the tenant
# cluster name via ResolveOrMint. Keep in sync with metadata.yaml `version`.
dagweave.io/catalog-version: "1.0.2"
dagweave.io/catalog-category: "Databases"
spec:
entrypoint: query
templates:
- name: query
inputs:
parameters:
# Database name to run the query against.
- name: database
# Collection to query.
- name: collection
# MongoDB find() filter as a JSON document. Defaults to all documents.
- name: filter-json
default: "{}"
# Name of the Kubernetes Secret holding the full connection URI (including
# any credentials), e.g. mongodb+srv://user:pass@host/. Defaults let a user
# leave them blank in the Inspector.
- name: uri-secret-name
default: mongodb-uri
- name: uri-secret-key
default: uri
container:
# Pinned by digest per the catalog convention: an image rebuild can never
# silently change the behaviour of an already-released item version.
# mongo:7 (ships the mongosh shell)
image: mongo@sha256:8bb4442761a63a8dda452744082cdac9644b429807eb977b42324a63cef59ca4
command: [sh, -c]
# The URI (with creds), database, collection and filter are all passed as env
# vars (below), never interpolated into the shell or the JS eval, so values
# containing quotes or shell metacharacters are safe. mongosh is Node-based so
# the eval reads them from process.env; the filter is parsed with JSON.parse.
args:
- |
set -eu
mongosh "$MONGO_URI" --quiet --eval '
db.getSiblingDB(process.env.DB_NAME)
.getCollection(process.env.COLL)
.find(JSON.parse(process.env.FILTER))
.toArray()
'
env:
- name: DB_NAME
value: "{{inputs.parameters.database}}"
- name: COLL
value: "{{inputs.parameters.collection}}"
- name: FILTER
value: "{{inputs.parameters.filter-json}}"
- name: MONGO_URI
valueFrom:
secretKeyRef:
name: "{{inputs.parameters.uri-secret-name}}"
key: "{{inputs.parameters.uri-secret-key}}"
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.2 latest 2026-10-19
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.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/mongodb-query/1.0.2/template.yaml -
1.0.1 2026-08-02
Repin mongo:7 on the current digest. Same tag, newer build, and the fixable CVE count does not move: still 192, because upstream has not shipped the fixes. Worth doing anyway so the pin is not a year behind the tag.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
-
1.0.0 2026-07-17
Initial release.
This release is documented, but its manifest is not vendored here, so it has no install command. Version document
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/mongodb-query \
-p collection=... \
-p database=...
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: mongodb-query-
spec:
workflowTemplateRef:
name: mongodb-query
arguments:
parameters:
- name: collection
value: "..."
- name: database
value: "..."
As a step of a larger workflow
steps:
- - name: mongodb-query
templateRef:
name: mongodb-query
template: query