title: How to use Node.js req.body send data into MongoDB aggregation $match pipeline
body: <p>I try to use req.body of node.js POST route method send a pair of number into Aggregation $match, $gte, $lte pipeline but does not work. See my code :</p>
  <pre><code>  &lt;form action=&quot;/transact/getState/&quot; method=&quot;post&quot;&gt;                       
    &lt;h1&gt; Query Transact # Range with Merchant Name Form &lt;/h1&gt;                         
    &lt;div class=&quot;form-group col-md-12&quot;&gt;  
    &lt;input class=&quot;box&quot; type=&quot;number&quot; name=&quot;tranNoF&quot; id=&quot;tranNoF&quot; value=&quot;0000000&quot; required/&gt;&lt;br&gt; 
    &lt;/div&gt; 
    &lt;div class=&quot;form-group col-md-12&quot;&gt;  
    &lt;input class=&quot;box&quot; type=&quot;number&quot; name=&quot;tranNoT&quot; id=&quot;tranNoT&quot;  value=&quot;9999999&quot; required/&gt;                           
    &lt;input type=&quot;submit&quot; id=&quot;submitDetails&quot;  name=&quot;submitDetails&quot; value=&quot;Submit&quot; /&gt;&lt;br&gt; &lt;/div&gt; 
    &lt;/form&gt;
     //-----------Get----open input form---------------
   router.get(&quot;/tran_no_range_agg/&quot;, (req, res) =&gt; {
   res.render(&quot;transacts/tran_search_state_agg.hbs&quot;);
   }),
   //--------------POST to aggregation -with req.body. method--------------------------------------------
  
  router.post(&quot;/getState/&quot;, async (req, res) =&gt; {
  const tranfr = req.body.tranNoF;
  const tranto = req.body.tranNoT;
  console.log(tranfr); // --I can see the number 5000200 I input
  console.log(tranto); //---I can see the number 5000206 I input   
  
  const result = await Transact.aggregate([
    {
      $match: {
        transact_number: { $gte: tranfr, $lte: tranto },
      },
    },
  
    {
      $group: {
        _id: null,
        totalA: { $sum: &quot;$transact_amount&quot; },
        count: { $sum: 1 },
       },
     },
   ])
    .then((response) =&gt; {
             res.json(response);
    })
    .catch((error) =&gt; {
      res.json({
        message: &quot;An error occured!&quot;,
       });
     });
  });
  //---------------------------------------------
  </code></pre>
  <p>if I hard code with $gte: 5000200, $lte: 5000206   it works. Otherwise localhost shows JSON [] keep formatting. Why the number is not in $match pipeline, I need you help. Thanks.</p>