Install
cargo install faucet-cli --features source-mongodb-cdc faucet init --source mongodb-cdc
# Cargo.toml — use it as a library cargo add faucet-source-mongodb-cdc
Starter config
source:
type: mongodb-cdc
config:
connection_uri: "" # REQUIRED — MongoDB connection URI.
# scope: { type: collection } # one of: collection, database, cluster
# --- Alternative variants — replace the block above with one of these ---
# type: database
# database: "" # REQUIRED
#
# type: cluster
# operation_types: [] # Allowlist of operation types (`insert`/`update`/`replace`/`delete`/...).
# full_document: null # Post-image inclusion mode (maps to the driver `FullDocumentType`).
# full_document_before_change: null # Pre-image inclusion mode (maps to the driver `FullDocumentBeforeChangeType`).
# start_from: { type: now } # one of: now, earliest, resume_token, timestamp
# --- Alternative variants — replace the block above with one of these ---
# type: earliest
#
# type: resume_token
# token: null # REQUIRED
#
# type: timestamp
# timestamp_secs: 0 # REQUIRED
# aggregation_pipeline: [] # Optional extra aggregation-pipeline stages, each a JSON object, appended after the operation-type `$match`.
# idle_timeout: 30 # Terminator: flush the buffer and end the fetch cycle after this much quiet.
# max_await_time_ms: 1000 # Server-side blocking `getMore` wait.
# batch_size: 1000 # Records per emitted `StreamPage`.
# max_staged_records: 1000000 # Max change records buffered in memory before a page is emitted, after which the run aborts with a typed `FaucetError::Source`.
Capabilities
| Replay | Deterministic replay |
|---|---|
| Exactly-once replay | Yes |
| Incremental | Yes |
| Dataset discovery | No |
| Reports lag | Yes |
| Compression | No |
Config fields
| Field | Type | Default | Description |
|---|---|---|---|
connection_urirequired | string | — | MongoDB connection URI. Must point at a replica set or sharded cluster. |
scope | object | type: cluster | Which change stream to open. |
operation_types | array | [] | Allowlist of operation types (insert/update/replace/delete/...). Empty = all. Prepended server-side as a $match on operationType. |
full_document | object | off | Post-image inclusion mode. |
full_document_before_change | object | off | Pre-image inclusion mode (MongoDB 6.0+). |
start_from | object | type: now | Start position on a fresh run; ignored once a bookmark exists. |
aggregation_pipeline | array | [] | Optional extra aggregation-pipeline stages, each a JSON object, appended after the operation-type $match. |
idle_timeout | integer | 30 | Terminator: flush the buffer and end the fetch cycle after this much quiet. Default 30s. |
max_await_time_ms | integer | 1000 | Server-side blocking getMore wait. Must be < idle_timeout. Default 1000. |
batch_size | integer | 1000 | Records per emitted StreamPage. 0 = drain until idle into one page. |
max_staged_records | integer | 1000000 | Max change records buffered in memory before a page is emitted, after which the run aborts with a typed FaucetError::Source. Defaults to 1,000,000; null = unbounded. The OOM safety valve: with batch_size: 0 (or a library caller using fetch_all) the change-event buffer would otherwise grow without bound for the whole fetch cycle and risk an OOM-kill on a high-throughput stream. Mirrors the same field on the sibling postgres-cdc / mysql-cdc sources. |
Get started
Your first pipeline runs in five minutes.
Install the CLI, scaffold a config, and move real data — nothing external to stand up.
curl -LsSf https://github.com/faucet-hq/faucet-stream/releases/latest/download/faucet-cli-installer.sh | sh brew install faucet-hq/faucet-stream/faucet-cli