const mongoose = require('mongoose'); const UserSchema = mongoose.Schema({ name: { type: String, required: true }, password: {type: String}, role: {type: String, required: true}, tags: [{type: String }], }); //tags as index: //UserSchema.index({tags:'text'}); module.exports = mongoose.model('User', UserSchema);