- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
- Get Started
- Product
- Resources
- Tools & SDKs
- Framework
- Reference
5.5.2. Data Model Property Types
In this chapter, you’ll learn about the types of properties in a data model’s schema.
These types are available as methods on the model
utility imported from @medusajs/framework/utils
.
id#
The id
method defines an automatically generated string ID property. The generated ID is a unique string that has a mix of letters and numbers.
For example:
text#
The text
method defines a string property.
For example:
number#
The number
method defines a number property.
For example:
bigNumber#
The bigNumber
method defines a number property that expects large numbers, such as prices.
For example:
boolean#
The boolean
method defines a boolean property.
For example:
enum#
The enum
method defines a property whose value can only be one of the specified values.
For example:
The enum
method accepts an array of possible string values.
dateTime#
The dateTime
method defines a timestamp property.
For example:
json#
The json
method defines a property whose value is a stringified JSON object.
For example:
array#
The array
method defines an array of strings property.
For example:
Properties Reference#
Refer to the Data Model API reference for a full reference of the properties.