Skip to main content
Skip table of contents

Collections

Introduction

The ClearBlade IoT Platform allows storing different data types in your IoT solution through collections. Each collection is available for users and devices to access via consoles, portals, APIs, and SDKs.

Within the ClearBlade IoT Platform context, a collection is synonymous with a database. It will be used extensively across the documentation.

To get a holistic view of collections, we categorize them into these sections:

  • Collection types: Collection types and how to work with them on the ClearBlade Platform

  • Collection management: Provides various collection management options

Click here for the Collections tutorial.

Purpose

ClearBlade collections provide a single interface for interacting with numerous database types.

Queries

See ClearBlade Platform SDK for the Collection API.

Data model queries

Data model queries allow developers to run raw SQL queries on the platform and edge instead of using the existing ClearBlade query model. These SQL queries can run against collection, 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 backed by a PostgreSQL instance. The platform can manipulate these collections regarding their schema and the data put into them.

Connection

The connection type allows developers 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 support ticket.

The following is required to configure a connection:

Field

Description

Example

Database Type

DB application type

MySQL

IP Address

Database URL

mydb.databases.com

Port

Port number on which the application is running

5432

Database Name

Database name

dbname

Connection Name

String

example

Table Name

String

sensor_data

Username

String

admin

Password

String

zrHcnzpBenHSOIq0uK/og8R

Column types

Type

Description

string

Series of characters. Example: Column 1

integer (int)

Positive or negative whole number

boolean (bool)

True/false

timestamp

03/29/21 22:15:07

float

Numbers with decimals

bigint

Large whole numbers

double

Large numbers with decimals

jsonb

See below

binary large object (blob)

A binary data collection stored as a single entity

universally unique identifier (uuid)

A 128-bit unique identification value. Example: bc37d0c0-fcf2-11d9-8cd6-0800200c9a66

jsonb

jsonb enables users to store JSON values in the database tables and query based on keys (for objects) or indexes (for arrays). Send stringified data when creating and updating all tables on a jsonb column.

Click here for an operator and function list.

Index/unique index

Collection columns can be indexed to speed up certain database operations. Unique indexing allows unique values to be used. The async library for indexing can be found under the Collection section. To configure indexing, go to the Edit column in a collection and mark the indexing box type under the column(s) you choose.

FAQ

  • How do I format the timestamp column in JavaScript to insert it into a collection?

You can create a timestamp variable using var curr_timestamp = new Date(); and insert it into the collection.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.