mongoose create text index code example
Example 1: mongoose create text index
mongoose.set('useCreateIndex', true)
// ...
schema.index({ title: 'text' })
Example 2: node js mongoose text index
var schema = new Schema({
name: String,
email: String,
profile: {
something: String,
somethingElse: String
}
});
schema.index({name: 'text', 'profile.something': 'text'});