I created a collection of categories with a name and description field. i.e
Categories = new Meteor.Collection('categories');
CategoriesSchema = new SimpleSchema({
translation:{
type: [Object]
},
"translation.$": {
type: Object
},
"translation.$.name": {
type: String
},
"translation.$.description": {
type: String
}
});
Categories.attachSchema( CategoriesSchema );
I need to create a text index to find categories by name or description. I saw Meteor js: create an index in a custom collection , but this is not about my need, I also tried
Meteor.startup(function () {
Categories._createIndex(
{ 'translation.$.name' : "text" },
{ 'translation.$.description' : "text" },
{ default_language: "english" }
);
});
I read about creating an Index in a meteor, but it didn’t work, or did I do it wrong? Any help would be appreciated.
source
share