If you have a string variable, you must convert it to a regex, so MongoDb will use a like statement on it.
const name = req.query.title; //Johndb.users.find({ "name": new Regex(name) });
Is the same result as:
db.users.find({"name": /John/})
If you have a string variable, you must convert it to a regex, so MongoDb will use a like statement on it.
const name = req.query.title; //Johndb.users.find({ "name": new Regex(name) });
Is the same result as:
db.users.find({"name": /John/})