---
title: "SparkPipe | Connectors | MongoDB Time-Series"
slug: "sparkpipe-connectors-mongodb-time-series"
description: "SparkPipe is a cloud-native service that utilizes the MQTT Sparkplug specification to securely connect to any MQTT 3.1 compatible broker, capturing all the events published by any Sparkplug-enabled edge node, and routing this data to cloud-based services and applications such as Apache Kafka, etc."
updated: 2025-09-30T15:55:37Z
published: 2025-12-19T15:12:25Z
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.n3uron.com/llms.txt
> Use this file to discover all available pages before exploring further.

# MongoDB Time-Series

## Overview

The MongoDB connector inserts all the Sparkplug metrics into a [MongoDB Time-Series](https://www.mongodb.com/products/capabilities/time-series) collection including the context and metadata provided by the Sparkplug protocol.

![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/AWS-N3-SparkPipe-Architecture-03.png)

### 

Each event stored in the database contains the following:

- The event **timestamp**, **name**, **data type** and**value.**
- The Sparkplug metadata in the **meta** object.
- The Sparkplug properties (if any) in the **properties** object.

![](https://cdn.document360.io/54093ab5-6b22-4542-a265-04377931f11a/Images/Documentation/image(38).png)

## Configuration

The default configuration for the MongoDB connector:

```ini
...
# Connectors configuration
[connectors]
  name = "mongo"

# MongoDB
[connectors.mongo]
  # Connection URI
  # Example:
  #   - mongodb+srv://<username>:<password>@cluster.8wkd5pc.mongodb.net/?retryWrites=true&w=majority
  uri = ""

  # SSL/TLS configuration
  tls_enabled                = true
  tls_client_certificate     = ""
  tls_client_certificate_key = ""
  tls_certificate_authority  = ""
  tls_insecure_skip_verify   = false

  # Name of the database
  database = "enterprise"

  # Name of the time-series collection
  collection = "uns-data"
```

#### Atlas Cluster

Example configuration to securely connect with a [MongoDB Atlas](https://www.mongodb.com/products/platform/atlas-database) cluster using [SCRAM-SHA-256 authentication](https://www.mongodb.com/docs/manual/core/security-scram/) (username/password) and TLS encryption:

```ini
...
# Connectors configuration
[connectors]
  name = "mongo"

# MongoDB
[connectors.mongo]
  # Connection URI
  uri = "mongodb+srv://<username>:<password>@cluster.8qjd4ff.mongodb.net/?retryWrites=true&w=majority"

  # SSL/TLS configuration
  tls_enabled                = true
  tls_client_certificate     = ""
  tls_client_certificate_key = ""
  tls_certificate_authority  = ""
  tls_insecure_skip_verify   = false

  # Name of the database
  database = "enterprise"

  # Name of the time-series collection
  collection = "uns-data"
```

#### Atlas Cluster with mTLS

Example configuration to securely connect to a [MongoDB Atlas](https://www.mongodb.com/products/platform/atlas-database) cluster using [mutual TLS authentication](https://www.mongodb.com/docs/manual/core/security-x.509/) with x.509 certificates:

```ini
...
# Connectors configuration
[connectors]
  name = "mongo"

# MongoDB
[connectors.mongo]
  # Connection URI
  uri = "mongodb+srv://cluster.8qjd4ff.mongodb.net/?retryWrites=true&w=majority"

  # SSL/TLS configuration
  tls_enabled                = true
  tls_client_certificate     = "/etc/sparkpipe/certs/client.crt"
  tls_client_certificate_key = "/etc/sparkpipe/certs/client.key"
  tls_certificate_authority  = "/etc/sparkpipe/certs/ca.crt"
  tls_insecure_skip_verify   = false

  # Name of the database
  database = "enterprise"

  # Name of the time-series collection
  collection = "uns-data"
```

#### Self-Managed Database

Example configuration to connect with a self-managed MongoDB database in the same VPC.

```ini
...
# Connectors configuration
[connectors]
  name = "mongo"

# MongoDB
[connectors.mongo]
  # Connection URI
  uri = "mongodb://ip-192-168-1-10.us-west-2.compute.internal:27017/?retryWrites=true&tls=false"

  # SSL/TLS configuration
  tls_enabled                = false
  tls_client_certificate     = ""
  tls_client_certificate_key = ""
  tls_certificate_authority  = ""
  tls_insecure_skip_verify   = false

  # Name of the database
  database = "enterprise"

  # Name of the time-series collection
  collection = "uns-data"
```
