How to use mongo db regex in express

I want to use regex such that in the url /todos?q=dho gives me all the results regarding to dho.

  • I tried using $regex syntax in the query.find() method but not giving the desired results. Thank You in advance

How and where to use regex for mongo db search such that I get the results?

todoRouter.get("/", async (req, res) => {
     let query = req.query;
     try {
          const todos = await todoModel.find(query);
          res.send(todos);
          } catch (err) {
               res.send(err);
          }
     })