Comprehensive mapping between MDL data types, Mendix internal types, and backend representations.
MDL Type Description Range/Limits
StringVariable-length text (default length 200) 1 to unlimited characters
String(n)Variable-length text with explicit length 1 to unlimited characters
Integer32-bit signed integer -2,147,483,648 to 2,147,483,647
Long64-bit signed integer -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
DecimalHigh-precision decimal number Up to 20 digits total
BooleanTrue/false value true or false (must have DEFAULT)
DateTimeDate and time with timezone awareness UTC timestamp
DateDate only (no time component) Internally stored as DateTime
AutoNumberAuto-incrementing integer Typically combined with NOT NULL UNIQUE
BinaryBinary data (files, images) Configurable max size
HashedStringSecurely hashed string (passwords) One-way hash, cannot be retrieved
MDL Type Description Example
Enumeration(Module.EnumName)Reference to an enumeration type Status: Enumeration(Sales.OrderStatus)
MDL Type BSON $Type Go Type (SDK)
StringDomainModels$StringAttributeType*StringAttributeType
String(n)DomainModels$StringAttributeType + Length*StringAttributeType{Length: n}
IntegerDomainModels$IntegerAttributeType*IntegerAttributeType
LongDomainModels$LongAttributeType*LongAttributeType
DecimalDomainModels$DecimalAttributeType*DecimalAttributeType
BooleanDomainModels$BooleanAttributeType*BooleanAttributeType
DateTimeDomainModels$DateTimeAttributeType*DateTimeAttributeType
DateDomainModels$DateTimeAttributeType*DateTimeAttributeType
AutoNumberDomainModels$AutoNumberAttributeType*AutoNumberAttributeType
BinaryDomainModels$BinaryAttributeType*BinaryAttributeType
EnumerationDomainModels$EnumerationAttributeType*EnumerationAttributeType
HashedStringDomainModels$HashedStringAttributeType*HashedStringAttributeType
MDL Default BSON Structure Go Structure
DEFAULT 'text'Value: {$Type: "DomainModels$StoredValue", DefaultValue: "text"}Value: &AttributeValue{DefaultValue: "text"}
DEFAULT 123Value: {$Type: "DomainModels$StoredValue", DefaultValue: "123"}Value: &AttributeValue{DefaultValue: "123"}
DEFAULT TRUEValue: {$Type: "DomainModels$StoredValue", DefaultValue: "true"}Value: &AttributeValue{DefaultValue: "true"}
(calculated) Value: {$Type: "DomainModels$CalculatedValue", Microflow: <id>}Value: &AttributeValue{Type: "CalculatedValue", MicroflowID: id}
Type Default Syntax Examples
String DEFAULT 'value'DEFAULT '', DEFAULT 'Unknown'
Integer DEFAULT nDEFAULT 0, DEFAULT -1
Long DEFAULT nDEFAULT 0
Decimal DEFAULT n.nDEFAULT 0, DEFAULT 0.00, DEFAULT 99.99
Boolean DEFAULT TRUE/FALSEDEFAULT TRUE, DEFAULT FALSE
AutoNumber DEFAULT nDEFAULT 1 (starting value)
Enumeration DEFAULT Module.Enum.ValueDEFAULT Shop.Status.Active, DEFAULT 'Pending'
Constraint Syntax Description
Not Null NOT NULLValue is required
Not Null with Error NOT NULL ERROR 'message'Required with custom error
Unique UNIQUEValue must be unique
Unique with Error UNIQUE ERROR 'message'Unique with custom error
Constraints must appear in this order:
NOT NULL [ERROR '...']
UNIQUE [ERROR '...']
DEFAULT <value>
MDL does not perform implicit type conversions. Types must match exactly.
Compatible type changes:
String(100) to String(200) – Increasing length
Integer to Long – Widening numeric type
Incompatible type changes:
String to Integer
Boolean to String
Any type to AutoNumber (if not empty)
/** Example entity demonstrating all data types */
@Position(100, 100)
CREATE PERSISTENT ENTITY Demo.AllTypes (
/** Auto-generated ID */
Id: AutoNumber NOT NULL UNIQUE DEFAULT 1,
/** Short text field */
Code: String(10) NOT NULL UNIQUE,
/** Standard text field */
Name: String(200) NOT NULL,
/** Long text field */
Description: String(unlimited),
/** Integer counter */
Counter: Integer DEFAULT 0,
/** Large number */
BigNumber: Long,
/** Money amount */
Amount: Decimal DEFAULT 0.00,
/** Flag field */
IsActive: Boolean DEFAULT TRUE,
/** Timestamp */
CreatedAt: DateTime,
/** Date only */
BirthDate: Date,
/** File attachment */
Attachment: Binary,
/** Status from enumeration */
Status: Enumeration(Demo.Status) DEFAULT 'Active'
)
INDEX (Code)
INDEX (Name, CreatedAt DESC);