You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add helpers to your collections, just like templates!
4
+
5
+
### Usage
6
+
7
+
A basic example
8
+
9
+
```javascript
10
+
Books =newMeteor.Collection('books');
11
+
Authors =newMeteor.Collection('authors');
12
+
13
+
Books.helpers({
14
+
author:function() {
15
+
returnAuthors.findOne(this.authorId);
16
+
}
17
+
});
18
+
19
+
Authors.helpers({
20
+
fullName:function() {
21
+
returnthis.firstName+''+this.lastName;
22
+
},
23
+
books:function() {
24
+
returnBooks.find({ authorId:this._id });
25
+
}
26
+
});
27
+
```
28
+
29
+
### Credits
30
+
31
+
Thanks to Mathieu Bouchard's work on [collection-hooks](https://github.com/matb33/meteor-collection-hooks) which assisted a great deal with extending Meteor.Collection.
0 commit comments