Custom Objects module provides flexibility to define any data structure (schema) you need, build 1-to-many relations between schemas and control permissions for all operations made on data. Schema is defined in QuickBlox Dashboard.
There are two key concepts in Custom Objects:
- Class represents your schema and contains field names and types.
- Record represents data you put into your schema.
Class and Record are similar to table and row in relational database. Every class in Custom Object module comes with five mandatory predefined fields: _id
, user_id
, parent_id
, created_at
, and updated_at
.
Allowed data types: Integer (or Array of Integer); String (or Array of String); Float (or Array of Float); Boolean (or Array of Boolean); Location (Array of [<longitude>, <latitude>]); File; Date.
For example, you want to store a simple calendar that stores the event title and event date. In this case, you can create a Calendar class with following fields: event_title
and event_date
.
Calendar records will have the following structure:
Field name | Type |
---|---|
_id* | String |
user_id* | Integer |
parent_id* | Integer |
event_title | String |
event_date | Date |
created_at* | Integer |
updated_at* | Integer |
Calendar data will look like:
_id* | user_id* | parent_id* | event_title | event_date | created_at* | updated_at* |
---|---|---|---|---|---|---|
5d866b53a28f9a5ad51cb562 | 96753878 | null | Meet John | 2019-12-25T14:00:00Z | 1576629761 | 1576629761 |
5d866b53a28f9a5ad51cb563 | 96753878 | null | Visit my dentist | 2019-09-25T15:00:00Z | 1577282400 | 1577282400 |