Product Documentation

MQTT V3 Plug-in Reference

Previous Topic

Next Topic

"mapOfPropertiesToFields"

  • Array of objects
  • Optional - If this property is omitted, a table with a JSON field named "doc" is created. For each message sent to this topic, c-tree will insert a record into this table and put the JSON payload of the message into this field.
  • No default value

This is an easy way to store the content of any MQTT message. The c-treeDB API can index and process the JSON contents of this field. The c-tree SQL engine cannot query the contents of the JSON field.

"AlterPersistenceTopic" resets the mapping of JSON properties to table fields.

  • It removes the existing mapping and creates a new one.
  • You can remap existing JSON properties to different fields.
  • You can choose not to map a JSON property to an existing field.
    • The handler inserts NULL into fields that are not mapped.
    • The handler does not remove existing fields from the table.

"AlterPersistenceTopic" can add new fields to the table.

  • You can map JSON properties to these new fields.
  • This uses a unique feature in c-tree, called Hot Alter Table, that allows you to alter table structure with no slowdown in inserts, updates, and deletes.

"AlterPersistenceTopic" can rename fields and change field types according to the rules of Hot Alter Table.

Each object in the "mapOfPropertiesToFields" array describes the characteristics of a JSON property and the characteristics of the table field to which it is mapped. There should be one mapping object for each JSON property that you want to map to a field. There can be fewer mapping objects than fields in the table. The message handler will insert NULL values into non-mapped fields. If there are no mapping objects, the message handler cannot insert data into the table.

TOCIndex