Class SchemaType<T, DocType>
Constructors
constructor
- new SchemaType<T, DocType>(path: string, options?: AnyObject, instance?: string): SchemaType<T, DocType>
Type Parameters
Parameters
path: string
Optional instance: string
Methods
Static cast
- cast(caster?: boolean | Function): Function
Parameters
Optional caster: boolean | Function
Returns Function
Static checkRequired
- checkRequired(checkRequired?: ((v: any) => boolean)): ((v: any) => boolean)
Parameters
Optional checkRequired: ((v: any) => boolean)
Parameters
Returns boolean
Returns ((v: any) => boolean)
Parameters
Returns boolean
Static set
- set(option: string, value: any): void
Parameters
Returns void
Static get
- get(getter: ((value: any) => any)): void
Parameters
getter: ((value: any) => any)
Returns void
cast
- cast(val: any, doc: <internal>.Document<any, any, any>, init: boolean, prev?: any, options?: any): any
Parameters
val: any
init: boolean
Optional prev: any
Optional options: any
Returns any
default
Parameters
Returns any
get
Parameters
immutable
Parameters
index
Parameters
ref
Parameters
required
- required(required: boolean, message?: string): SchemaType<T, DocType>
Parameters
required: boolean
Optional message: string
select
Parameters
set
Parameters
sparse
Parameters
text
Parameters
transform
- transform(fn: ((value: any) => any)): SchemaType<T, DocType>
Parameters
fn: ((value: any) => any)
unique
Parameters
validate
- validate(obj: RegExp | ((this: DocType, value: any, validatorProperties?: Validator) => any), errorMsg?: string, type?: string): SchemaType<T, DocType>
Parameters
obj: RegExp | ((this: DocType, value: any, validatorProperties?: Validator) => any)
Optional errorMsg: string
Optional type: string
Properties
OptionsConstructor
instance
instance: string
Optional isRequired
isRequired?: boolean
options
path
path: string
schema
schema
: Schema<any, <internal>.Model<any, any, any, any, any>, {}, {}, {}, {}, DefaultSchemaOptions, {}>validators
Optional defaultOptions
SchemaType constructor