Collections
Introduction
The ClearBlade IoT platform allows for storing different types of data in your IoT solution through Collections. Each collection is available for users and devices to access via Console, Portals, APIs and SDKs.
Within the context of the ClearBlade IoT Platform, a Collection is synonymous with a Database, and will be used extensively across the documentation.
To get a holistic view of collections, we categorize them into following sections:
- Collection Types - types of collections and how to work with them on ClearBlade platform.
- Collection Management - provides various collection management options
For the collection management tutorial, click here
Purpose
ClearBlade Collections provide a single interface for interacting with numerous types of databases.
Queries
See ClearBlade Platform SDK for Collection API
Data Model Queries
Data Model allows developers to run raw SQL queries on platform and edge instead of using the existing ClearBlade query model. These SQL queries can run against collections, user and device tables. Developers should use the data model when running operations such as JOIN
and other operations not supported by the ClearBlade Query Model.
See ClearBlade Native Libraries for the API
Collection Types
Cloud
ClearBlade provides a default cloud collection, which is backed by a Postgresql instance. These collections are able to be completely manipulated by the platform in terms of their schema, and the data put into them.
Connection
The Connection type allows the platform developer to integrate existing databases with their IoT Platform application.
- MySQL
- PostgreSQL
- MongoDB
- Oracle
- DB2_Linux
- DB2_zOS
- DB2_System_i
- Microsoft_SQL_Server
- Cassandra
- CouchDB
To request integrations, please create a ticket at Support
The following is required to configure a Connection:
Field | Description | Example |
---|---|---|
Database Type | DB Application Type | MySQL |
IP Address | URL of database | mydb.databases.com |
Port | port number on which the application is running | 5432 |
Database Name | Name of Database | dbname |
Connection Name | string | example |
Table Name | string | sensor_data |
Username | string | admin |
Password | string | zrHcnzpBenHSOIq0uK/og8R |
Index/Unique Index
Collection columns can be indexed to speed up certain database operations. Unique indexing allows for unique values to be used. The async library for indexing can be found under the ‘Collection’ section here. To configure indexing, go to ‘Edit column’ in a collection and mark the box of the type of indexing under the column(s) of your choice.
FAQ
- How do I format the timestamp column in javascript to insert it into a collection?
> User can create a timestamp variable using:
var curr_timestamp = new Date();
and can insert it into the collection.