Data Property
The definition of a data property within a data object. A data property is not just a storage field—it encapsulates the logic, behavior, and metadata associated with a specific piece of data. Through
DataProperty
MPO Version: 1.3.0
The definition of a data property within a data object. A data property is not just a storage field—it encapsulates the logic, behavior, and metadata associated with a specific piece of data. Through its settings, a data property can define relationships, context-aware values, session-based defaults, computed formulas, access filters, enums, and more. It serves as a powerful unit of business logic tightly integrated with the data model.
interface DataProperty = {
basicSettings : PropertyBasicSettings;
indexSettings : PropertyIndexSettings;
relationSettings : PropertyRelation;
sessionSettings : PropertySessionSettings;
staticJoin : PropertyStaticJoin;
}
| Field | Description |
|---|---|
| basicSettings | Defines the foundational attributes of the data property — name, type, source, isRequired, hasRelation, isFilterParameter, enumOptions (when type === 'Enum'), defaultValues, and the rest of the per-property flags. The activation booleans for relation, filter, and enum live here so a property's design lives in one place. |
| indexSettings | Controls how the property is indexed in storage systems to optimize lookup and uniqueness behaviors. |
| relationSettings | Defines relationship mappings when basicSettings.hasRelation === true. Foreign-key target object, key, on-delete behavior, etc. Leave null/absent when hasRelation is false. |
| sessionSettings | Specifies how the property's value is derived from the session context when basicSettings.source === 'session'. Leave null/absent for other sources. |
| staticJoin | Defines the static-join configuration when basicSettings.source === 'joined'. Leave null/absent for other sources. |
PropertyBasicSettings
MPO Version: 1.3.0
Defines the core structure and behavior of a data property. Beyond basic typing, this section governs how the property participates in data integrity, mutability, API exposure, and logic-driven behaviors such as hashing or auto-increment. Use this section to establish the foundational logic and identity of the property within your data object.
interface PropertyBasicSettings = {
name : String;
type : DataTypes;
isArray : Boolean;
description : Text;
isRequired : Boolean;
allowUpdate : Boolean;
autoIncrement : Boolean;
hashed : Boolean;
isSecret : Boolean;
defaultName : Boolean;
isFilterParameter : Boolean;
enumOptions : String[];
defaultValue : AnyComplex;
}
| Field | Description |
|---|---|
| name | Unique identifier for the property within the data object. This name is used throughout route definitions, generated code, and logic expressions. Use camelCase formatting, avoid spaces and special characters, and ensure the name is unique within the same data object. |
| type | Defines the property's data type. Use a value from the DataTypes. The selected type impacts validation, storage schema, and frontend component inference. |
| isArray | Indicates if the property stores multiple values (array). Supported by databases like PostgreSQL and MongoDB. Default is false. |
| description | Optional textual description of the property's role in the domain. Useful for documentation and as a semantic hint across logic and UI components. |
| isRequired | If true, the underlying DB column is NOT NULL — the persisted record must hold a non-null value. This is independent of where the value comes from at runtime; the framework will reject the write if no value reaches the column from any of: a requestParameters binding consumed by dataClauseItems, a sessionSettings auto-inject, a staticJoin resolution, or a basicSettings.defaultValue DB default. |
| allowUpdate | Controls whether the property can be modified after creation. If false, updates to this field are ignored unless overridden explicitly. |
| autoIncrement | If true, this property will be auto-generated by incrementing the latest existing value. Suitable for numeric IDs or sequences managed internally. |
| hashed | If true, the property's value will be hashed before storage. This is irreversible and is typically used for storing passwords or other sensitive values. |
| isSecret | If true, this property holds a secret value (e.g. API key, QR code, token) that should be protected from exposure to AI models. In MCP tool responses, secret fields are masked with *** and a __proxyCode is provided so the AI can request frontend rendering of the actual value. The frontend can display secret values as text, barcode, or QR code through a dedicated action card. Unlike hashed, secret values are stored in cleartext and can be retrieved by authorized users. |
| defaultName | If true, this property is used as the default display label for records of this data object. When rendering relation dropdowns or record references in the frontend, the value of this property will be shown as the human-readable label. Only one property per data object should be marked as defaultName. If none is set, the frontend will fall back to common field names like 'name', 'title', or the first String property. |
| isFilterParameter | If true, the property is exposed as a query-string filter on the data object's auto-generated list APIs. The filter name is the property name itself (no separate alias). Filter type/operator follows the property's type automatically. |
| enumOptions | Required when type === 'Enum'. Ordered list of string values the property can take. Must contain at least 2 options. Leave null/absent for non-enum properties. |
| defaultValue | DB-level scalar default for the property's column. Applied at write time when no other source supplies a value (no requestParameter, no sessionSettings auto-inject, no staticJoin, no dataClauseItems entry). Type must match basicSettings.type and respect isArray. For computed defaults like now() or LIB.<fn>(), leave defaultValue null and write a per-API dataClauseItems entry with the MScript expression instead — defaultValue is intentionally limited to scalar literals so it can be enforced at the DB level. |
DataTypes
These are the standardized data types used in microservice data models and BFF data views in Mindbricks.
const DataTypes = {
ID: "ID",
String: "String",
Text: "Text",
Integer: "Integer",
Boolean: "Boolean",
Double: "Double",
Float: "Float",
Short: "Short",
Object: "Object",
Date: "Date",
Enum: "Enum",
GeoPoint: "GeoPoint",
GeoRoute: "GeoRoute",
GeoArea: "GeoArea",
Blob: "Blob",
};
| Enum | Description |
|---|---|
| ID | Represents a unique identifier. Implemented as UUID in SQL databases and ObjectID in NoSQL databases. |
| String | Represents short text values, typically capped at 255 characters. |
| Text | Represents long-form text content suitable for descriptions or rich text. |
| Integer | Represents 4-byte integer values used for whole numbers. |
| Boolean | Represents logical values true or false. |
| Double | Represents 8-byte double-precision floating-point numbers. |
| Float | Represents 4-byte single-precision floating-point numbers. |
| Short | Represents 2-byte short integers, useful for flags. |
| Object | Represents a generic JSON object, useful for flexible data structures. |
| Date | Represents date-time values, stored as ISO 8601 strings in UTC timezone. |
| Enum | Represents a fixed set of string values. Enum options are defined as an array of strings and internally stored as a short string. |
| GeoPoint | Repesents a geography point on the earth. It is a POINT GeoJson object storing lon and lat values. |
| GeoRoute | Represents a geography route on the earth. It is a LINESTRING GeoJson object, with an array of lon and lat pairs. |
| GeoArea | Represents a geography area on the earth. It is a POLYGON GeoJson object, with an array of lon and lat pairs. It hsould be closed as the last and first points should be equal. If not first point will be added automaticall as last point also. |
| Blob | Represents binary large object data. Stored as BYTEA in PostgreSQL or Buffer in MongoDB. Used for file content in database buckets. |
PropertyIndexSettings
MPO Version: 1.3.0
Index configuration for the data property across supported storage and caching layers. This includes Elasticsearch indexing for query performance, relational database indexing for faster selection, and Redis-based optimizations for efficient cache invalidation and retrieval. Use these settings to control how the property contributes to performance, queryability, and caching logic.
interface PropertyIndexSettings = {
indexedInElastic : Boolean;
fulltextSearch : Boolean;
indexedInDb : Boolean;
unique : Boolean;
clusterInRedis : Boolean;
cacheSelect : Boolean;
isSecondaryKey : Boolean;
}
| Field | Description |
|---|---|
| indexedInElastic | Determines whether the property is indexed in the Elasticsearch CQRS index. When enabled, this property can be used in DataView filters and search queries. |
| fulltextSearch | If set to true, Mindbricks will create an additional text index in elastic search other than the type based term query. Note that this feature is ignored if indexedInElastic is false. Text type data properties are alread have full text search. |
| indexedInDb | Specifies whether a native database index should be created for this property to accelerate selection queries. Recommended for frequently filtered or sorted fields. |
| unique | Indicates whether the property's value must be unique across all records. Enabling this will enforce a uniqueness constraint at the database level. |
| clusterInRedis | Specifies whether the property should contribute to Redis cluster keys for partial cache invalidation. This improves cache sensitivity but may increase Redis storage. |
| cacheSelect | Defines whether this property is used as a key in Redis entity cache for batch-select operations. Enables lookup by this value across cached entities. |
| isSecondaryKey | Marks the property as a secondary identifier, improving query performance on non-primary keys. Useful for access tokens, slugs, or alternative keys. |
PropertyRelation
MPO Version: 1.3.0
Defines the foreign-key relationship for this property to another data object. Populate this block when basicSettings.hasRelation === true. Leave null/absent otherwise. The activation flag lives on basicSettings (next to source) so a single property-level write declares both the source and the relation.
interface PropertyRelation = {
relationName : String;
relationTargetObject : DataObjectName;
relationTargetKey : PropRefer;
onDeleteAction : RelationOnDeleteAction;
relationIsRequired : Boolean;
}
| Field | Description |
|---|---|
| relationName | A single-word, human-readable name that identifies the relationship. This name is used in generated code and documentation to represent joined data via this relation. |
| relationTargetObject | The name of the data object this property relates to. This defines the target of the foreign key relationship. |
| relationTargetKey | The property name (usually 'id') in the target object that this property references. This is the destination key for the relation. |
| onDeleteAction | Determines what action should be taken if the related (parent) object is deleted. Options include cascading the delete or nullifying this property. |
| relationIsRequired | Defines whether the relation is mandatory. If true, the property must always reference a valid record in the related data object. |
RelationOnDeleteAction
Defines the available strategies for handling related records when a referenced (parent) object is deleted.
const RelationOnDeleteAction = {
doDelete: "doDelete",
setNull: "setNull",
};
| Enum | Description |
|---|---|
| doDelete | Automatically delete this object if the referenced target object is deleted. This is a cascading delete. |
| setNull | Set this property to null when the referenced object is deleted, effectively removing the relation without deleting this object. |
PropRefer
MPO Version: 1.3.0
Represents a reference to a property of a data object, optionally renaming it in the current context. It is a string data, however can store string pairs joined with ':'.The first part is the name ofthe property and the second part after ':' mark is how it will be renamed in the context. If no second partis provided, the property is named in the context with its original name. Renaming is useful for mapping remote object properties to local aliases or transforming naming for aggregation.
interface PropRefer = {
}
| Field | Description |
|---|
PropertySessionSettings
MPO Version: 1.3.0
Defines how this property is populated from the session context when basicSettings.source === 'session'. Session-driven properties are commonly used to associate records with the current user or tenant automatically during create/update operations. Leave the wrapping object null when the property's source is not session.
interface PropertySessionSettings = {
sessionParam : String;
isOwnerField : Boolean;
}
| Field | Description |
|---|---|
| sessionParam | Specifies the name of the session field to bind to this property. Defaults to the property name if not explicitly provided. For example, if the session contains userId, that can be mapped to this field. |
| isOwnerField | Marks this property as the ownership field for the data object. When true, the property is used to enforce ownership-based access control (e.g., ensuring users can only modify their own records). This should be used when the property semantically identifies the owner of the record, typically a userId. |
PropertyStaticJoin
MPO Version: 1.3.0
Static join settings define how this property's value is derived from another data object at the time of creation or update when basicSettings.source === 'joined'. This approach is useful when a field in the current object depends on a static value from a related object, and that value is not expected to change frequently. Unlike dynamic joins, static joins store the fetched value directly to allow for faster queries and avoid repeated lookups. A common use case is transferring tenant or client identifiers from a parent object into a child record. For example, when creating an email job for a specific user, the system can use the userId to join the User object, fetch its clientId, and statically assign it to the EmailJob object. This makes it easy to query email jobs by clientId without needing to join back to the User table at runtime. Note that, all static joins are executed before any per-API customData entries, so customData expressions can read the joined value via this.<property>. Leave the wrapping object null when the property's source is not joined.
interface PropertyStaticJoin = {
jointSource : DataObjectName;
jointRead : PropRefer;
jointSourceKey : PropRefer;
jointForeignKey : PropRefer;
defaultValue : MScript;
}
| Field | Description |
|---|---|
| jointSource | The name and optionally the service of the source object from which the value will be joined. If the source is in another service, Mindbricks will automatically use Elasticsearch indexing to perform the join. |
| jointRead | The name of the property in the source object whose value will be copied into the current property. Defaults to the same name as this property if not specified. |
| jointSourceKey | The key in the source object used to identify the matching record. This is typically 'id' as the primary identifier of the source object. This field acts as the join source in the static join relationship. |
| jointForeignKey | The property in the current object used as a reference to the source object (i.e., the foreign key). For example, if joining user.clientId via userId, the foreign key is 'userId'. |
| defaultValue | An optional fallback MScript value to use when static join cannot find a source record, or when the joined read value resolves to null/undefined. |
Last updated today
Built with Documentation.AI