Data/BeanCollection

Data/BeanCollection

# new Data/BeanCollection()

Base bean collection class. It extends Backbone.Collection.

A bean collection is a collection of beans. To instantiate a bean collection, you need to use Data/DataManager#createBeanCollection.

Example of usage:

The following snippet will create a collection of bean which belongs to the module 'Accounts':

const DataManager = require('./data-manager');
let accounts = DataManager.createBeanCollection('Accounts');
accounts.add({name: 'account1', industry: 'Banking'});

Filtering and searching

The collection's Data/BeanCollection#fetch method supports filter and search options. For example, to search favorite accounts that have the string "Acme" in their name:

const DataManager = require('./data-manager');
let accounts = DataManager.createBeanCollection('Accounts');
accounts.fetch({
    favorites: true,
    query: "Acme"
});