简单模式有效值列表
Simple Schema valid values lists
我正在使用 Simple Schema,我希望有一种方法可以根据预定义列表或另一个列表验证某些字段中的值
根据预定义的、未更改的列表(如枚举)进行验证。这可能可以用复杂的正则表达式来完成,但这感觉不对:
dialogType: {
type: String,
label: "Dialog Type", // 'article', 'sentence','exercise','lesson','word'
optional: false
},
针对用户集合进行验证,可能会应用一些过滤器:
userId: {
type: String,
label: "User ID",
optional: false
}
相关问题
Bind allowedValues to values from a collection in simple-schema
我想你可以按如下方式进行:
dialogType: {
type: String,
allowedValues: ['article', 'sentence','exercise','lesson','word'],
optional: true
},
你看过了吗https://github.com/aldeed/meteor-simple-schema#allowedvalues
我正在使用 Simple Schema,我希望有一种方法可以根据预定义列表或另一个列表验证某些字段中的值
根据预定义的、未更改的列表(如枚举)进行验证。这可能可以用复杂的正则表达式来完成,但这感觉不对:
dialogType: {
type: String,
label: "Dialog Type", // 'article', 'sentence','exercise','lesson','word'
optional: false
},
针对用户集合进行验证,可能会应用一些过滤器:
userId: {
type: String,
label: "User ID",
optional: false
}
相关问题 Bind allowedValues to values from a collection in simple-schema
我想你可以按如下方式进行:
dialogType: {
type: String,
allowedValues: ['article', 'sentence','exercise','lesson','word'],
optional: true
},
你看过了吗https://github.com/aldeed/meteor-simple-schema#allowedvalues