Mongoose membuat indeks teks
mongoose.set('useCreateIndex', true)
// ...
schema.index({ title: 'text' })
florinrelea
mongoose.set('useCreateIndex', true)
// ...
schema.index({ title: 'text' })
var schema = new Schema({
name: String,
email: String,
profile: {
something: String,
somethingElse: String
}
});
schema.index({name: 'text', 'profile.something': 'text'});