Back to destination list
Official
MongoDB destination integration documentation
This destination plugin lets you sync data from any CloudQuery source to a MongoDB database
Loading plugin documentation
This destination plugin lets you sync data from any CloudQuery source to a MongoDB database
Loading plugin documentation
CloudQuery's use of cookies
We use tracking cookies to understand how you use the product and help us improve it. Your consent is required before we can enable these cookies. You can opt out via the link in the footer.
localhost:27017. The (top level) spec section is described in the Destination Spec Reference.kind: destination
spec:
name: "mongodb"
path: "cloudquery/mongodb"
registry: "cloudquery"
version: "v3.1.1"
send_sync_summary: true
spec:
# required, a connection string in the format mongodb://localhost:27017
connection_string: "${MONGODB_CONNECTION_STRING}"
# required, the name of the database to sync to
database: "${MONGODB_DATABASE_NAME}"
# Optional parameters:
# batch_size: 10000 # 10K
# batch_size_bytes: 4194304 # 4 MiB
# write_retry: # <- Opt-in retries on transient network errors. Safe with write_mode: overwrite, or with use_transactions on a replica set / sharded cluster.
# max_attempts: 5 # Total attempts per batch, including the first. Default 1 (retries disabled).
# max_backoff: "10s"
# use_transactions: false # Set true to wrap each retried batch in a MongoDB transaction (requires replica set / sharded cluster).
# aws_credentials: # <- Use this to specify non-default role assumption parameters
# default: true # Use the default credentials chain
# local_profile: "mongodb-profile" # Use a local profile instead of the default one
# role_arn: "arn:aws:iam::123456789012:role/role_name" # Specify the role to assume
# external_id: "external_id" # Used when assuming a role
# role_session_name: "session_name" # Used when assuming a role
batch_size and batch_size_bytes.connection_string (string) (required)"mongodb://username:password@hostname:port/database" basic connection"mongodb+srv://username:[email protected]/database" connecting to a MongoDB Atlas cluster"mongodb://localhost:27017/myDatabase?authSource=admin" specify authentication sourcedatabase (string) (required)batch_size (integer) (optional) (default: 1000)batch_size_bytes (integer) (optional) (default: 4194304 (= 4 MiB))aws_credentials (aws_credentials) (optional)write_retry (write_retry) (optional)write tcp ...: broken pipe) that the driver's single built-in retry can't recover from. Disabled by default.max_attempts >= 2 to enable application-level retries.max_attempts (integer) (optional) (default: 1)1 means no application-level retries — the MongoDB driver's own single retry still applies.max_backoff (duration) (optional) (default: "10s")use_transactions (bool) (optional) (default: false)true, each retried write batch runs inside a MongoDB transaction so a retry that follows a partially-applied write rolls back the partial state before re-attempting. This is what makes retries safe on write_mode: append tables: without a transaction, an ambiguous failure (server processed the write but the response was lost) can produce duplicate documents, because _id is server-generated and the retry has no way to dedupe against the previous attempt.max_attempts is 1.default (bool) (optional)true then AWS SDK will use the default credentials based on the AWS Credential chainlocal_profile (string)[default]
aws_access_key_id=xxxx
aws_secret_access_key=xxxx
[user1]
aws_access_key_id=xxxx
aws_secret_access_key=xxxx
local_profile should be set to either default or user1.role_arn (string)role_session_name (string)role_arn.external_id (string)role_arn.