MongoDB Time Series Overview
MongoDB Time Series collections (opens in a new tab) offers a highly optimized method for storing time-based data, which is often generated at high volume and velocity in IoT solutions.
Qubitro Storage Function for MongoDB Time Series forwards either raw or processed data directly into predefined MongoDB Time Series collections.
Prerequisites
- Active Qubitro account on the Enterprise plan
- MongoDB Atlas account with a cluster that supports Time Series collections.
- MongoDB Credential
Add 145.40.114.97/32 to the Access List Entry
or IP Access List
on MongoDB Atlas.
Reserved keys
The time
key is reserved and will be ignored by the function.
Configuring the Storage Function
Select a device that you want to create a function for and navigate to the detail page. Click on the Functions
tab, then, click on the Create function
button.
Choose MongoDB Time Series
from the list.
Configure function basics
Choose the MongoDB Credential and provide basic information for the function including name and description and click on Next
.
Configure MongoDB options
Provide the required information including database, collection, Timefield and Metafield (optional) and click on Done
. The provided information must match the configuration on MongoDB Atlas.
Verify the incoming data
In this example, the following data is published to the Qubitro with an HTTP data source.
{
"Pressure_PSI": 55.29,
"Temperature_Celsius": 15.62,
"battery_level": 3.29406,
"firmware_version": 6,
"node_id": 0,
"reserve_byte": 0,
"rssi": 100,
"time": "2023-10-25T07:49:00.673679Z",
"transmission_count": 72,
"type": 26,
"is_active": true,
"status_message": "Operational"
}
You can verify that the raw data is inserted successfully and Device ID
with Project ID
is automatically set under the metadata.
Insert Transformed Data
You can also transform data on the fly before inserting it into the MongoDB collection by enabling and selecting a Transformation Function.
The following example demonstrates how to insert modified data into MongoDB while simultaneously inserting raw data into Qubitro.
An example transformation function:
Transformed data:
{
"Battery": 3.29406,
"Pressure": 55.29,
"Status": "Operational",
"Temperature": 15.62,
"time": "2023-11-08T19:05:47.91485Z"
}
Raw data on device data table:
Transformed data on MongoDB Atlas collection:
If you need further help, you can browse support plan options.
Start building today
Collect, process, and activate device data. Scale from one device to thousands.