import { Index, MongoDBEngine } from 'meteor/easy:search'
// Client and Server
const index = new Index({
...
engine: new MongoDBEngine({
selector(searchDefinition, options, aggregation) {
// retrieve the default selector
const selector = this.defaultConfiguration()
.selector(searchObject, options, aggregation)
// options.search.userId contains the userId of the logged in user
selector.owner = options.search.userId
return selector
},
}),
permission: (options) => options.userId, // only allow searching when the user is logged in
});
If I copy this code into my app, I see an error that searchObject is not defined.
I think 'searchDefinition' needs to be 'searchObject'?
I think there's a typo in one of the examples on this page:
http://matteodem.github.io/meteor-easy-search/docs/recipes/
The first example for a custom selector is this:
If I copy this code into my app, I see an error that searchObject is not defined.
I think 'searchDefinition' needs to be 'searchObject'?