Documentation
Plugins
Destinations
MongoDB
Overview

MongoDB Destination Plugin

Latest: v2.2.14

This destination plugin lets you sync data from any CloudQuery source to a MongoDB database.

Supported database versions:

Configuration

Example

This example configures a MongoDB destination, located at localhost:27017. The (top level) spec section is described in the Destination Spec Reference.

kind: destination
spec:
  name: "mongodb"
  registry: "github"
  path: "cloudquery/mongodb"
  version: "v2.2.14"
  spec:
    connection_string: "mongodb://localhost:27017"
    database: "your_mongo_database_name"
    # Optional parameters:
    # batch_size: 10000 # 10K
    # batch_size_bytes: 4194304 # 4 MiB

Make sure to use environment variable substitution in production instead of committing the credentials to the configuration file directly.

The MongoDB destination utilizes batching, and supports batch_size and batch_size_bytes.

MongoDB Spec

This is the (nested) spec used by the MongoDB destination Plugin.

  • connection_string (string) (required)

    MongoDB URI as described in the official MongoDB documentation (opens in a new tab).

  • database (string) (required)

    Required database to sync the data to.

  • batch_size (integer) (optional) (default: 1000)

    This parameter controls the maximum amount of items may be grouped together to be written as a single write.

  • batch_size_bytes (integer) (optional) (default: 4194304 (= 4 MiB))

    This parameter controls the maximum size of items that may be grouped together to be written as a single write.