MongoDB
Schemes: mongodb://
Query parameters recognised as config fields for this connector. The object-typed tls is set with a JSON literal, e.g. ?tls={...}. Any other ?key=value pair is passed through unchanged as a driver option on the connection URL.
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
capped_size_bytes | integer | no | — | (Publisher only) If set, creates a capped collection with this size in bytes. |
change_stream | boolean | no | false | (Consumer only) Deprecated — use consume: subscriber. Kept for compatibility. |
checkpoint_store | string | no | — | (Consumer only) Where to persist the resume cursor in capture_new/capture_all mode. A URL selects the backend; a bare name (or /name) reuses the source database with that name: - absent → source database, collection mqb_cursors_<source_collection> (auto-unique) - /my_cursors → source database, collection my_cursors - file:///var/lib/mqb/cursors.json → local JSON file (read-only / write-restricted sources) - mongodb://host/db/collection → external MongoDB collection (collection optional) - postgres://user@host/db/table or mysql://host/db/table → external SQL table (table optional) - s3://bucket/prefix (also gs://, az://, abfs://) → cloud object store; creds via env When no collection/table is named, it defaults to mqb_cursors_<source_collection>. May embed connection credentials, so it is treated as a secret. |
collection | string | no | — | The MongoDB collection name. |
consume | consumer | subscriber | capture_new | capture_all | no | — | (Consumer only) How to consume the collection: consumer (default, competing-consumers work queue — destructive and ~5x slower), subscriber (ephemeral queue), capture_new (watch an existing collection for changes), or capture_all (read existing documents first, then watch for changes — use this for single-reader bulk reads and ETL). The bridge selects the underlying mechanism automatically. If unset, the deprecated change_stream boolean is honored for backward compatibility. |
cursor_id | string | no | — | The ID used for the cursor in sequenced mode. If not provided, consumption starts from the current sequence (ephemeral). |
database | string | yes | — | The database name. |
format | normal | json | text | raw | no | normal | Format for storing messages. Defaults to Normal. |
id_field | string | no | — | (Publisher only) Top-level payload field whose value becomes the document _id, for idempotent inserts via the unique _id index. Sink collections only. |
meta_collection | string | no | — | (Optional) Collection to store sequence counters and cursor positions. Defaults to the message collection if not set. |
password | string | no | — | Optional password. Takes precedence over any credentials embedded in the url. Use embedded URL credentials for simple one-off connections but prefer explicit username/password fields (or environment-sourced secrets) for clarity and secret management in production. |
polling_interval_ms | integer | no | — | (Consumer only) Polling interval in milliseconds for the consumer (when not using Change Streams). Defaults to 100ms. |
receive_query | string | no | — | (Consumer only) Optional custom MongoDB query to filter messages. Provided as a JSON string (e.g., ‘{“type”: “notification”}’). |
reply_polling_ms | integer | no | — | (Publisher only) Polling interval in milliseconds for the publisher when waiting for a reply. Defaults to 50ms. |
report_outcome | boolean | no | false | (Publisher only) Return the message with metadata mongodb.outcome = inserted/existed (dup-key) so a request+switch can branch. Sink collections only; pair with id_field. |
request_reply | boolean | no | false | (Publisher only) If true, the publisher will wait for a response in a dedicated collection. Defaults to false. |
request_timeout_ms | integer | no | — | (Publisher only) Timeout for request-reply operations in milliseconds. Defaults to 30000ms. |
shared | boolean | no | true | Share one MongoDB client per connection (default: true); false forces a dedicated client. |
tls | object | no | see below | TLS configuration. |
ttl_seconds | integer | no | — | (Publisher only) TTL in seconds for documents created by the publisher. If set, a TTL index is created. |
url | string | yes | — | MongoDB connection string URI. Can contain a comma-separated list of hosts for a replica set. If it contains userinfo, it will be treated as a secret. Credentials provided via the separate username and password fields take precedence over any credentials embedded in the URL. |
username | string | no | — | Optional username. Takes precedence over any credentials embedded in the url. Use embedded URL credentials for simple one-off connections but prefer explicit username/password fields (or environment-sourced secrets) for clarity and secret management in production. |
Struct-typed fields
tls
TLS configuration for secure connections.
Configures Transport Layer Security (TLS/SSL) for encrypted communication. Supports both client certificate (mutual TLS) and server certificate validation.
Examples
use mq_bridge::models::TlsConfig;
let tls = TlsConfig {
required: true,
ca_file: Some("/path/to/ca.pem".to_string()),
cert_file: Some("/path/to/cert.pem".to_string()),
key_file: Some("/path/to/key.pem".to_string()),
..Default::default()
};
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
accept_invalid_certs | boolean | no | false | If true, disable server certificate verification (insecure). |
ca_file | string | no | — | Path to the CA certificate file. |
cert_file | string | no | — | Path to the client certificate file (PEM). |
cert_password | string | no | — | Password for the private key (if encrypted). |
key_file | string | no | — | Path to the client private key file (PEM). |
required | boolean | no | false | If true, enable TLS/SSL. |