I have a msg.text
variable Incomming from Telegram Bot, msg.text
is = My Schema name, How Should I get names Contain words entered by the user ?
schema:
const parentSchema = new Schema({
_id: Number,
name: String,
});
parentSchema.plugin(mongoosastic, {
hosts: [
'localhost:9200'
]
});
const Mq = mongoose.model('Mq', parentSchema);
module.exports = Mq;
Code:
bot.onText(/\/search/, (msg) => {
// mangoosastic search Code
});
Forexample in my db I have {rock
, book
, pre rock
, Cat
, rock after
, and pre rock after
}
and user msg.txt
= ro
How Should I get and console.log Words Contain ro
in node.js Project:
I need to get:
rock
pre rock
rock after
pre rock after