Skip to content

MongoDB ​

Reads documents from one collection. Use cdc_mode: snapshot for a copy, or snapshot_then_cdc after you enable change streams.

Before you begin ​

  • A connection string the Skipprd host can use.
  • Read access on database.collection.
  • A replica set (or Atlas) when you use CDC — standalone nodes do not offer change streams.
bash
export MONGODB_URI="mongodb+srv://skippr:${MONGODB_PASSWORD}@cluster.mongodb.net/"

Configure ​

python
from skippr import Config, DataSourceMongodb, EnvRef, Pipeline

cfg = Config.discover()
src = cfg.data_source(
    "app",
    DataSourceMongodb(
        connection_string=EnvRef("MONGODB_URI"),
        database="app",
        collection="orders",
        cdc_mode="snapshot",
    ),
)
cfg.pipeline("orders", Pipeline(data_source=src))
cfg.save()
bash
skipprd connect data-source mongodb \
  --pipeline orders \
  --name app \
  --connection-string '${MONGODB_URI}' \
  --database app \
  --collection orders \
  --cdc-mode snapshot
yaml
data_sources:
  app:
    Mongodb:
      connection_string: ${MONGODB_URI}
      database: app
      collection: orders
      cdc_mode: snapshot

Options ​

KeyTypeRequired/DefaultDescription
connection_stringsecretRequiredMongoDB URI as ${ENV}
databasestringRequiredDatabase
collectionstringRequiredCollection
filterobjectNot setQuery filter for the snapshot
batch_size_rowsintegerNot setDocuments per batch
formatstringNot setDocument format override
batch_size_bytesintegerNot setMax bytes per batch
batch_size_secondsintegerNot setMax seconds per batch
cdc_modestringsnapshotsnapshot, snapshot_then_cdc, or cdc_only

What gets synced ​

Each document becomes a row. Nested fields are discovered as structured columns. CDC applies inserts, updates, and deletes — see Change data capture.

Troubleshooting ​

SymptomFix
Auth failedCheck the URI user and that it can read the collection
Change stream errorUse a replica set / Atlas, and a CDC mode
TimeoutAllow the Skipprd host in Atlas network access

Next steps ​