Class: ddpCollection

ddpCollection

DDP collection class.

new ddpCollection (name, server)

Name Type Description
name String

Collection name.

server simpleDDP

simpleDDP instance.

Classes

ddpCollection

Methods

exportData (format)string | Object

Exports data from the collection.

Name Type Default Description
format string 'string' optional

If 'string' then returns EJSON string, if 'raw' returns js object.

Returns:
Type Description
string | Object

fetch (settings)Object

Returns collection data based on filter and on passed settings. Supports skip, limit and sort. Order is 'filter' then 'sort' then 'skip' then 'limit'.

Name Type Default Description
settings Object {skip:0,limit:Infinity,sort:null} optional

Skip and limit are numbers or Infinity, sort is a standard js array sort function.

Returns:
Type Description
Object

filter (f)this

Allows to specify specific documents inside the collection for reactive data and fetching.

Name Type Description
f function

Filter function, recieves as arguments object, index and array.

Returns:
Type Description
this

importData (data)

Imports data inside the collection and emits all relevant events. Both string and JS object types are supported.

Name Type Description
data string | Object

EJSON string or EJSON or js object.

onChange (f, filter)Object

Returns change observer.

Name Type Description
f function
filter function
See:
Returns:
Type Description
Object
  • @see ddpOnChange

reactive (settings)Object

Returns reactive collection object.

Name Type Default Description
settings Object {skip:0,limit:Infinity,sort:null} optional
See:
Returns:
Type Description
Object
  • @see ddpReactiveCollection