title: How to filter results by multiple query parameters if I don't know beforehand how many query strings I may receive from client side?
body: <p>I want to send in response some data according to searching by query parameters (using .find function of mongoose) from the client side. What do I need to do is a search according to the parameters received?</p>
  
  <p>What I mean is : 
  I may receive</p>
  
  <pre><code>localhost:5000/admin/customers?customer_id=1&amp;customer_email=abc@gmail.com
  </code></pre>
  
  <p>I could have used this code to send results according to this query :</p>
  
  <pre><code>Customer.find({
    customer_id = req.query.customer_id,
    customer_email = req.query.customer_email,
  }, (err,docs)=&gt; {
      res.json(docs);
  })
  </code></pre>
  
  <p>or
     just</p>
  
  <pre><code>localhost:5000/admin/customers?customer_id=1
  </code></pre>
  
  <p>I could have used this code to send results according to this query :</p>
  
  <pre><code>Customer.find({
    customer_id = req.query.customer_id
  }, (err,docs)=&gt; {
      res.json(docs);
  })
  </code></pre>
  
  <p>or
  may be</p>
  
  <pre><code>localhost:5000/admin/customers?no_of_items_purchased=15
  </code></pre>
  
  <p>I could have used this code to send results according to this query :</p>
  
  <pre><code>Customer.find({
    no_of_items_purchased = req.query.no_of_items_purchased
  }, (err,docs)=&gt; {
      res.json(docs);
  })
  </code></pre>
  
  <p>But what I want is to use .find function on anything received from query params. Like a general code to achieve this.</p>
  
  <p>PS: Also please help with : "How to filter req.query so it only contains fields that are defined in your schema ?"</p>