String
Property Type: string
Strings represent a text value and can be configured with validators to limit input using regular expressions, and to enforce minimum and maximum lengths.
Property Options
Name
Type
Default
Description
trim
boolean
false
Trims the input string prior to validation but after writers.
lowercase
boolean
false
Lowercase the input string prior to validation but after writers.
uppercase
boolean
false
Uppercase the input string prior to validation but after writers.
localization
document
Content
String localization options. Note: Although query matching for localized string values is possible, some cases (like $elemMatch) are not supported.
localization.enabled
boolean
false
Enable localization for the string values. Reading and writing to the property occurs on the current locale or the options below. When any string in an object definition is localized, a locales
property document appears in the instance. Inside it, each localized string property is represented by an array of documents containing each locale and value that have been written ({locale: 'en_US', value: 'foo'}
). Note: Once enabled, localization on a string cannot be disabled.
localization.valid
string[]
[]
Limits writing to a set of locales. Leaving this empty allows all org-level valid locales.
localization.fixed
string
''
Limit the native string property to reading and writing this locale. For reading, the fallback option still applies.
localization.strict
boolean
true
For reading and writing, throw an error if the selected locale is invalid. When false, the fallback option is used to attempt to return a fallback value.
localization.fallback
boolean
true
For reading, fallback to any usable locale value when none exists for the requested locale.
localization.acl
document[]
[]
A set of acl entries to apply to direct reading and writing of the locales-prefixed string property document array.
localization.readAccess
number
4 (read)
The resolved access level required to read the locales-prefixed property document array.
localization.writeAccess
number
6 (update)
The resolved access level required to update the locales-prefixed property document array.
localization.aclOverride
boolean
false
When true, the acl entries that are applied to the locales-prefixed property document array are applied from scratch to the caller, instead of augmenting their current access level.
Property Validators
Required name: required
String Validator name: string
definition:
Name
Type
Default
Description
min
integer
0
Minimum length of string
max
integer
Content
Maximum length of string
allowNull
boolean
false
Allow null values
allowEmpty
boolean
false
Allow 0-length strings
Printable String Validator name: printableString
definition:
Name
Type
Default
Description
anyFirstLetter
boolean
true
Allow the first letter of the string to be non-alphanumeric.
allowNumberAsFirstLetter
boolean
true
Allows a number as the first letter of the string.
min
integer
0
min length
max
integer
Content
max length
String Enum Validator name: stringEnum
definition:
Name
Type
Default
Description
values
array
Content
An array of possible entries.
Email Validator name: email
definition:
Name
Type
Default
Description
allowNull
boolean
true
Allow blank or null entries
Locale Validator name: locale
definition:
Name
Type
Default
Description
allowNull
boolean
false
Allow blank or null entries
Password Strength Validator name: passwordStrength
definition:
Name
Type
Default
Description
minScore
integer
Content
The minimum password score requirement (based on zxcvbn)
Phone Number Strength Validator name: phoneNumber
definition:
Name
Type
Default
Description
allowNull
boolean
false
Allow null entries.
requireMobile
boolean
false
If true, requires the number to be a mobile number.
allowedCountries
array or strings
Content
List of allowed countries
URL Validator name: url
definition:
Name
Type
Default
Description
allowNull
boolean
false
Allow null values
allowEmpty
boolean
false
Allow 0-length strings
webOnly
boolean
true
Url must be a web url, beginning with http:// or https://
webSecure
boolean
Content
Applies when webOnly is true. If present, url must either be https:// (true) or http:// (false). Omitting this property allows either.
Pattern Validator name: pattern
definition:
Name
Type
Default
Description
allowNull
boolean
false
Allow null values
allowEmpty
boolean
false
Allow 0-length strings
pattern
regex
Content
The regex pattern to test against the incoming string value
Last updated