DynamicCollection

Constructor

new DynamicCollection()

(DEPRECATED - Use createCollection() instead)

Creates a new DynamicCollection instance.

DynamicCollection is an extension of the native Array object thus implementing all of Array's methods and properties.

Parameters:

  • Model: DynamicRecord.Model - The Model constructor to use for this collection

Properties

data: Array

Returns a native array of data objects


Methods

static fromArray → DynamicCollection

Converts an array of objects into a DynamicCollection. If an element in the array is not an object, it will be skipped.

Parameters:

  • array: Array - Array to be converted into a DynamicCollection

Returns:

DynamicCollection -

saveAll → Promise

Save all the model instances in the DynamicCollection.

Simply calls all the individual model's save() method.

Returns:

Promise - Return promise of this DynamicCollection instance

dropAll → Promise

Destroy all the model instances in the DynamicCollection.

Simply calls all the individual model's destroy() method.

Returns:

Promise - Return promise of this DynamicCollection instance