I am looking for a solution to incorporate a variable pattern in mongoose:
router.get('/search/:name', async(req, res) => {
name = req.params.name;
const products = await Product.find({ name: /.*name*/i }).limit(10);
res.send(products);
});
I need the flexibility to modify the name variable.