In the code bellow Products.find({ "name": search }) does not filter results, instead the whole MongoDB list of results is returned.
router.get('/search', (req, res) => {
const search = req.query.third;
Products.find({ "name": search }).then(result => {
res.render('search', { Products: result });
})
.catch(err => {
console.log(err);
});
});
How can I solve it?