Problem to query MongoDB through collection.find from simple text box in browser page

I use a mongodb database where I have its internal log data. With Express, Node and Monk (following this guide) I have to try to get data from a search text box, and I stopped on how to request this data.

from the userlist.ejs page I have implemented a form where I send a GET request:

`http://localhost:3000/userlist?name=5044`

where then I go to get name through

`search = req.query.name` 

and then insert it into the collection.find({search}…

below is the index.js:

    /* GET Userlist page. */
    router.get('/userlist', function(req, res) {

        search = req.query.name;

        var db = req.db;
        var collection = db.get('startup_log');
        collection.find({search},{},function(e,docs){
            res.render('userlist', {
              "userlist" : docs
        });
    });
    

this is the userlist.ejs page where I send the request. which later should display it through the for loop after processing it from index.ejs,

     <!DOCTYPE html>
    <html>
       <head>
         <title>User List</title>
         <link rel='stylesheet' href='/stylesheets/style.css' />
       </head>
     <body>
         <h1>User List</h1>

         <input type="text" id="titles" />

    <form action="/userlist" method="GET" encType="multipart/form-data">
      <label htmlFor="newNote">New Note:</label>
        <input type="text" name="name"  className="form-control" rows="5" 
         id="name" placeholder="5044"></input>
        <button id="done" type="submit" className="btn btn-primary pull- 
         right">Done</button>
        <button id="cancel" className="btn btn-warning pull- 
       right">Cancel</button>
    </form>

     <ul>
        <% for (var i = 0; i < userlist.length; i++) {%>
     
        <li><%= userlist[i].hostname %></li>
         
            <li></li>        
         <%}%>
      </ul>
     </body>
    </html>

i can’t figure out how to pass to collection.find the query i enter in the text box! any help would be appreciated as I cannot find specific information about my case. Thanks in advance!