Collections allow for storing different types of data in your IoT solution.
By going into our IoT System and clicking collections we can view our different data stores. To create a collection click the “Add Collection” button and provide a name and click create. Its possible to alter the schema of the collection by clicking Edit Columns. With the dialog open we can add to three columns for product_name, order_amount, and customer_name. Click Done when finished. Now that schema is altered, lets add an item to the collection by clicking on the + add item button. The new item has a unique item_id generated and the other columns are empty. We can then provide values for each item in the collection.
|product_name (string)||order_amount (int)||customer_name (string)|
Each collection is available for users and devices to access via Portals, APIs and SDKs, but by default the collection has all access privileges turned off. By going to the settings on the collection we can provide update the associated role access. In this case we are going to give Authenticated users the ability to read, create, update and delete from this collection. Now we can use a very basic API call from a curl statement to access this collection. Notice the authtoken that is valid for authenticated user. When we submit this call we get back the full dataset, but if alter the key to be invalid the request will come back with security error
The user table can easily be filtered from the developer console. On the users page click the filter icon, select the column and the complete the filter criteria. Click filter and now see the data according your rules. To remove the filter, click the filter icon and choose “Clear All” and then reapply the filter.
Its possible to use existing databases in your IoT solution using collections of type Connect. This means your mongo, sql server and other databases can all be exposed and leveraged. To create a new connection navigate back to your systems collection page. In the collection page click the New Icon. In the dialog provide a name, then change the Type to Connection. In the dropdown that appears, select MongoDB. Complete the form using your personal mongo cloud instance, noting this will only work assuming your Mongo DB is publically available ot the internet. When finished click “Create”, the connection will be established and your mongo data table will now be mapped as a ClearBlade collection for real time interactions. As with internal cloud connections, these new connections can be edited according to the password information you provided.
Adding a new column:
Select “+ Column” above the table display.
Enter a one word column name, and select the corresponding data type from the dropdown. Verify the information and click Submit.
Hiding an existing column:
Click the arrow to the right of the column name that is to be hidden.
Hiding a column will not delete the data. To restore the column to the view, refresh the page. Select “Hide Column” from the dropdown, and then click Submit on the modal that appears.
Remove an existing column:
WARNING: Data will be permanently deleted. Click the arrow to the right of the column name that is to be deleted.
Select “Delete Column” from the dropdown, and then click Submit on the modal that appears.
Add a new data row:
Select “+ Row” above the table display.
A new row will be created with a unique item_id. To enter data into the row, click the cell corresponding to the row and column.
Remove an existing data row:
WARNING: Data will be permanently deleted. Click the checkmark icon to the left of the row that is to be deleted. Select “- Row” above the table display.