dispatch:collection-view
Create collection views.
Usage
1 var foo = new Mongo.Collection('foo'); 2 3 var fooView = new CollectionView({ 4 collection: foo, 5 transform: function(doc) { 6 return { 7 birthday: doc.birthday, 8 age: calculateAge(doc.birthday), 9 address: address.findOne(doc.addressId) 10 }; 11 } 12 });
fooView
acts like a regular Mongo.Collection
and will update by observing on foo
.
This allows sorting by dynamically generated attributes.
Api
There are two functions added:
foo.stop();
- This will stop the view and clear the viewfoo.start();
- This will start the view or throw an error if already started
Note: Using the start will default values but you can also change the values foo.start(selector, transform)