I established a category collection featuring a name and description field. Example:
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 );
In my quest to find categories by name or description, I realize the need to create a text index. I came across Meteor js: Create index in user collection, but it didn't align with what I required. I also attempted:
Meteor.startup(function () {
Categories._createIndex(
{ 'translation.$.name' : "text" },
{ 'translation.$.description' : "text" },
{ default_language: "english" }
);
});
I delved into creating an index in Meteor, yet it wasn't successful, or perhaps I erred in doing so? Any assistance on this matter would be highly valued.