because you might want to create a special index that does not support the mongoose schema, for example: text search index โtextโ, you can use
Model.collection.ensusreIndex( { title: "text", tags: "text", description: "text" }, { weights: { title: 10, tags: 5, }, name: "TextIndex" },function(err,data){ if(err){ return res.send({success:false,err:err}) }else{ return res.send({success:true,res:'successfuly build index'}) }; }) )
so for this reason you need to call securityIndex () yourself
source share