Easy-search and collection-helpers

I’m following the Usage with collection-helpers example in the guide: http://matteodem.github.io/meteor-easy-search/docs/recipes/

Here are the relevant versions of things:

Meteor 1.7.0.3

easy:search@2.2.1
easysearch:components@2.2.1
easysearch:core@2.2.0

dburles:collection-helpers@1.1.0

Here’s what the code in my /lib/collections folder looks like:

import { Index, MongoDBEngine } from 'meteor/easy:search'

Channels = new Mongo.Collection("channels");

Channels.helpers({
  convertedName() {
    if (this.name) {
      return this.name
    } else {
      var memberIdsWithoutCurrentUser = _.without(this.members, Meteor.userId());
      var userNamesNotIncludingCurrentUser = Meteor.users.find({_id: {$in: memberIdsWithoutCurrentUser}}).map(function(user) {
        return user.username
      });
      return userNamesNotIncludingCurrentUser.join(", ")
    }
  }
});

ChannelsIndex = new Index({
  collection: Channels,
  fields: ['convertedName'],
  engine: new MongoDBEngine({
    transform: (doc) => Channels._transform(doc)
  })
});

If I use something other than convertedName for the fields in the Index, all the documents are returned with convertedName available, but I obviously can’t search by convertedName which is what I’m looking for.

I’m fairly new to Meteor. What am I doing wrong? :slight_smile: