API Reference

SchemaType.Array Class

Defined in lib/types/array.js:5
Extends SchemaType

Description

Schema type: Array.

Constructor

SchemaType.Array

([options])

Schema type: Array.

Parameters

Methods

cast

(value) Array
Inherited from SchemaType but overwritten in: lib/types/array.js:54

Casts the given value to an array.

Parameters

  • value Any

Returns

checkRequired

(value) Boolean
Inherited from SchemaType but overwritten in: lib/types/array.js:42

Checks if the given value is an array.

Parameters

  • value Any

Returns

compare

(data, value) Boolean
Inherited from SchemaType but overwritten in: lib/types/array.js:70

Compares data.

Parameters

Returns

q$all

(data, value) Boolean

Checks whether data contains all elements in value.

Parameters

Returns

q$exists

(data, value) Boolean
Inherited from : lib/schematype.js:126

Checks whether the field exists.

q$exists is also aliased as q$exist.

Parameters

  • data Any
  • value Any

Returns

q$gt

(data, value) Boolean
Inherited from : lib/schematype.js:182

Checks whether data is greater than value.

Parameters

  • data Any
  • value Any

Returns

q$gte

(data, value) Boolean
Inherited from : lib/schematype.js:195

Checks whether data is greater than or equal to value.

q$gte is also aliased as q$min.

Parameters

  • data Any
  • value Any

Returns

q$in

(data, value) Boolean
Inherited from SchemaType but overwritten in: lib/types/array.js:136

Checks whether data contains value.

Parameters

Returns

q$length

(data, value) Boolean

Checks whether the number of items in data matches value.

q$length is also aliased as q$size.

Parameters

Returns

q$lt

(data, value) Boolean
Inherited from : lib/schematype.js:154

Checks whether data is less than value.

Parameters

  • data Any
  • value Any

Returns

q$lte

(data, value) Boolean
Inherited from : lib/schematype.js:167

Checks whether data is less than or equal to value.

q$lte is also aliased as q$max.

Parameters

  • data Any
  • value Any

Returns

q$ne

(data, value) Boolean
Inherited from : lib/schematype.js:141

Checks whether data is equal to value. If not, return true.

Parameters

  • data Any
  • value Any

Returns

q$nin

(data, value) Boolean
Inherited from SchemaType but overwritten in: lib/types/array.js:161

Checks whether data not contains value.

Parameters

Returns

q$where

(data, value) Boolean
Inherited from : lib/schematype.js:274

Validates data with value function.

Parameters

Returns

q$within

(data, value) Boolean
Inherited from : lib/schematype.js:248

Checks whether data is between value.

Parameters

Returns

q$without

(data, value) Boolean
Inherited from : lib/schematype.js:261

Checks whether data is not between value.

Parameters

Returns

save

(value) Any
Inherited from : lib/schematype.js:101

Transforms a value into JSON.

Parameters

  • value Any

Returns

  • Any

u$addToSet

(data, value) Array

Adds value to data only if not exist yet.

Parameters

Returns

u$pop

(data, value) Array

Removes the last items from data.

Parameters

Returns

u$pull

(data, value) Array

Removes value from data.

Parameters

Returns

u$push

(data, value) Array

Adds value to the last of data.

Parameters

Returns

u$push

(data, value) Array

Removes the first items from data.

Parameters

Returns

u$unshift

(data, value) Array

Adds value to the front of data.

Parameters

Returns

Properties

default

Inherited from : lib/schematype.js:54

The default value of the field.

required

Inherited from : lib/schematype.js:66

Determines whether the field is required.

type

static