models.Collection


Extends bindable.Collection

Installation

npm install mojo-models --save-exact

Collection(properties[, application])

  • properties - properties to set on the collection

data

the raw source for the collection. Should be an array.

model createModel(options)

Creates a model. This method is usually defined when extending the base collection. It's also called when deserializing each item in data. See example above.

idProperty

The id property for each model. This id "_id" by default.

model create(properties)

creates a new model, and adds to the collection immediately. See example above.

deserialize(data)

Deserializes data, and sets the returned value as the source of the array.

serialize()

serializes collection into an array. alias to toJSON

Extended API

See extended api on models.Base