Skip to content

Commit 59ce0e4

Browse files
author
Pieter Soudan
committed
add ne woptions to README
1 parent 70fdeb5 commit 59ce0e4

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

+20-1
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,30 @@ Template.searchResult.helpers({
7272
});
7373
```
7474

75-
`.getData()` api accepts an object with options. These are the options you can pass:
75+
`.getData()` api accepts an object with options (and an optional argument to ask for a cursor instead of a fetched array; see example below). These are the options you can pass:
7676

7777
* `transform` - a transform function to alter the selected search texts. See above for an example usage.
7878
* `sort` - an object with MongoDB sort specifiers
7979
* `limit` - no of objects to limit
80+
* `docTransform` - a transform function to transform the documents in the search result. Use this for computed values or model helpers. (see example below)
81+
82+
83+
```js
84+
Template.searchResult.helpers({
85+
getPackages: function() {
86+
return PackageSearch.getData({
87+
docTransform: function(doc) {
88+
return _.extend(doc, {
89+
owner: function() {
90+
return Meteor.users.find({_id: this.ownerId})
91+
}
92+
})
93+
},
94+
sort: {isoScore: -1}
95+
}, true);
96+
}
97+
});
98+
```
8099

81100
### Searching
82101

0 commit comments

Comments
 (0)