UNPKG

jcms

Version:

un cms utilisant node.js et mongoDB

30 lines (29 loc) 959 B
{ nickname: String // Types can be specified as functions... , text: { type: 'string' // ...or they can be specified as strings. , required: true // Makes the attribute required for the model to validate. }, timestamp: { type: Date, validators: [ // Custom validator functions can be set in an array function (val) { // Each validator will be given the value of the field if (val > new Date()) { return 'Timestamp can not be set to a future date.'; } } ] }, kind: { required: true, type: String, choices: [ // Enum-esque functionality. Forces the attribute to be 'message' // one of these choices in order to be valid. , 'left' , 'joined' ] }, _isStrict: true // Enables strict mode, which disallows arbitrary attributes }