From estuary-schema
Creates a MongoDB CDC capture using flowctl for real-time streaming from MongoDB Atlas, DocumentDB, or self-hosted MongoDB. Automates connector setup and YAML generation.
How this skill is triggered — by the user, by Claude, or both
Slash command
/estuary-schema:capture-mongodb-createThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create a MongoDB capture using flowctl to stream data from MongoDB collections into Estuary collections using Change Data Capture (CDC).
Create a MongoDB capture using flowctl to stream data from MongoDB collections into Estuary collections using Change Data Capture (CDC).
Applies to: source-mongodb, source-amazon-documentdb, source-azure-cosmos-db
Before proceeding, fetch the official connector docs for prerequisites, config reference, and deployment-specific setup.
Always load the main page: https://docs.estuary.dev/reference/Connectors/capture-connectors/MongoDB/
Then load the variant subpage based on the user's deployment:
| Deployment | Docs URL |
|---|---|
| MongoDB Atlas | Main page covers this |
| Self-hosted MongoDB | Main page covers this |
| Amazon DocumentDB | https://docs.estuary.dev/reference/Connectors/capture-connectors/MongoDB/amazon-documentdb/ |
| Azure Cosmos DB | https://docs.estuary.dev/reference/Connectors/capture-connectors/MongoDB/azure-cosmosdb/ |
Use WebFetch to load these pages. Together they cover:
This skill provides the flowctl workflow and troubleshooting that docs don't cover.
Before writing any YAML, ask the user:
Critical check: MongoDB CDC requires a replica set. Atlas and DocumentDB always are. Self-hosted standalone will NOT work — must be converted to replica set first.
Always use the latest numbered version tag. Query the connector registry to find it:
flowctl raw get --table connector_tags \
--query 'documentation_url=ilike.*source-mongodb*' \
--query 'select=image_tag,documentation_url' \
--output yaml
Choose the connector image:
| Deployment | Connector Image |
|---|---|
| MongoDB Atlas / Self-hosted | ghcr.io/estuary/source-mongodb |
| Amazon DocumentDB | ghcr.io/estuary/source-mongodb (same connector, different config) |
| Azure Cosmos DB | ghcr.io/estuary/source-mongodb (same connector, different config) |
Walk the user through prerequisites from the docs loaded in Step 0:
rs.status() should return replica set info, not an errorread role on target database and read on local (for oplog)Build flow.yaml using the config reference from the docs. Minimal required config:
captures:
<tenant>/<path>/source-mongodb:
endpoint:
connector:
image: ghcr.io/estuary/source-mongodb:<version>
config:
address: "<connection_string>"
database: "<database_name>"
user: "<username>"
password: "<password>"
bindings: []
Important: The user and password fields are required even if MongoDB auth is disabled.
For SSH tunnel, add networkTunnel.sshForwarding block — see docs for full config.
These are critical and easy to get wrong — not fully covered in docs:
# MongoDB Atlas (SRV)
mongodb+srv://cluster0.xxxxx.mongodb.net/?authSource=admin
# MongoDB Atlas (standard)
mongodb://shard-00-00.xxxxx.mongodb.net:27017,.../?ssl=true&replicaSet=atlas-xxxxx&authSource=admin
# Self-hosted (single node replica set)
mongodb://hostname:27017/?authSource=admin&directConnection=true
# Amazon DocumentDB
mongodb://docdb-cluster.xxxxx.us-east-1.docdb.amazonaws.com:27017/?ssl=true&replicaSet=rs0&retryWrites=false
# Via ngrok (local dev)
mongodb://0.tcp.ngrok.io:12345/?authSource=admin&directConnection=true
Key parameters:
authSource=admin — required when user is defined in admin dbdirectConnection=true — use for single-node connectionsssl=true — required for Atlas and DocumentDB# Discover collections
flowctl discover --source flow.yaml
# Review the generated bindings
cat flow.yaml
# Publish the capture
flowctl catalog publish --source flow.yaml --auto-approve
# Check status (expect PENDING → BACKFILLING → OK: Streaming Change Events)
flowctl catalog status <tenant>/<path>/source-mongodb
# View recent logs
flowctl logs --task <tenant>/<path>/source-mongodb --since 5m | jq -c '{ts, message}'
# Read captured data
flowctl collections read --collection <tenant>/<path>/<database>/<collection> --uncommitted | head -10
Status progression:
PENDING — normal for ~30 seconds during shard assignmentBACKFILLING — initial snapshot of collectionsOK: Streaming Change Events — CDC running normallyCause: MongoDB is standalone, not a replica set
Fix: Atlas/DocumentDB are always replica sets. For self-hosted:
# Add to mongod.conf, restart, then:
mongo --eval "rs.initiate()"
Cause: Invalid credentials or missing permissions
Fix:
authSource parameter (usually admin)db.grantRolesToUser("flow_capture", [
{ role: "read", db: "target_database" },
{ role: "read", db: "local" }
])
authSource=admin in connection stringCause: User authenticates against admin db but authSource not specified
Fix: Add ?authSource=admin to connection string.
Cause: Incorrect connection string or network issues
Fix:
ssl=true)Cause: Oplog rolled over while connector was paused/stopped
Impact: Connector must re-snapshot all data (happens automatically)
Prevention: Increase oplog size, keep retention at least 24 hours, don't pause captures for extended periods.
Cause: Config missing user/password fields
Fix: Always include user and password even if MongoDB auth is disabled — use placeholder values.
In MongoDB, deleting a field from a document appears as an "update" event, not a delete. The captured document reflects the new state without that field.
Wait 30-60 seconds — this is normal during shard assignment. If still stuck:
flowctl logs --task <tenant>/<path>/source-mongodb --since 5m | jq 'select(.level == "error" or .level == "warn")'
connector-disable-enable — Pause/restart existing capturesconnector-delete-recreate — Nuclear option for stuck capturesestuary-logs — Deep log analysisestuary-catalog-status — Status checkingGuides collaborative design exploration before implementation: explores context, asks clarifying questions, proposes approaches, and writes a design doc for user approval.
Creates structured, bite-sized implementation plans from specs or requirements before writing code. Useful for breaking down multi-step tasks into testable steps with file structure and task boundaries.
Resolves in-progress git merge or rebase conflicts by analyzing history, understanding intent, and preserving both changes where possible. Runs automated checks after resolution.
npx claudepluginhub estuary/agent-skills --plugin estuary-schema