I was not able to create index for profile
:
var user = new Schema({
profile : "String",
fullname:"String"
})
user.statics.createIndexOfProfile = function(callback){
this.ensureIndex("profile",function(err,doc){
if(err) {
console.log(err+'sna');
callback(err);
}
else {
console.log(doc+'santhosh');
callback(null,doc);
}
});
I was getting error like this.ensureIndex is not a function