title: Mongoose search query
body: <p>I'm implementing a search through a Mongodb database using Mongoose. On the client side, I have:</p>
  
  <pre><code>var searchQuery = {
              title: ($('#responseTitle').val()),
              text: ($('#responseKeywords').val())
          };
  
  $.ajax({
          type: "GET",
          url: "../../api/threads",
          data: searchQuery,
          success: function(data){
              prefetchedResponses = data;
              loadResponseBrowser();
          }
      })
  </code></pre>
  
  <p>On the server-side, I have:</p>
  
  <pre><code>router.get('/', function(req, res, next) {
      Response.find(req.query, function(err, foundResponses){
      ...
  </code></pre>
  
  <p>This works, but only returns matches with the exact fields. I want to implement a regex-type search. However, I can't decide whether to do it on the client or server-side. On the server side, it would involve iterating through each field of <code>req.query</code> and appending the necessary properties to enable for regex search. On the client side, it would be easier, by just constructing <code>title</code> and <code>text</code> with those properties pre-defined. However, doing it on the client-side seems wrong to me, since the backend could change at any time. </p>
  
  <p>Is there a third alternative in Mongoose that would allow me to apply regex to all fields? </p>