title: mongoose $gte and $lte not working properly
body: <p>lately I have been developing an application where i need to get documents that are inside a specific location based radius. when I send the latitude and longitude to the server, my code properly calculates the minimum and maximum latitude and longitude. I try to put the calculated numbers inside $gte and $lte in mongoose query, but the expected results wouldn't show up!</p>
  
  <p>I have tried the following mongoose query:</p>
  
  <pre><code>{ name: /^انار0$/i }
  </code></pre>
  
  <p>and I have got the following response:</p>
  
  <pre><code>[
  {
      "rating": {
          "average": 0,
          "count": 0
      },
      "location": {
          "latitude": 33.635,
          "longitude": 70.889
      },
      "status": "ONLINE",
      "_id": "5c62fa691fab8f24209f36e6",
      "name": "انار0",
      "_type": "CAFE"
  }
  ]
  </code></pre>
  
  <p>but when I send location and the query turns into the following:</p>
  
  <pre><code>{ location:
      { latitude:
          { 
              '$gte': 33.626016646154675,
              '$lte': 33.64398335384532
           },
       longitude:
           { 
               '$gte': 70.88152061196703,
               '$lte': 70.89647938803296
            } 
        },
        name: /^انار0$/i
  }
  </code></pre>
  
  <p>I get an empty jsonarray as my response, where the response should not be different with the former query!</p>
  
  <p>here is my code:</p>
  
  <pre><code>let query = {};
  if (location.lat &amp;&amp; location.lng){
      /**
       * earth radius is approximately 6378 kilometers
       * so each degree is 111.3170 km based on the (2*Pi/360) * 6378
       * basically each degree is 111317 meters
       * if we want shops in a 1000 meter radius then 1000 meters in degree would be 1000 / 111317
       */
      let Pi = Math.PI;
      if (isNaN(radius)) {
          radius = 1000; // radius in meters
      }
      let radiusInDegrees = radius / 111317;
  
      let locationQuery = {};
      locationQuery.latitude = {};
      locationQuery.longitude = {};
  
      locationQuery.longitude.$gte = location.lng - (radiusInDegrees * Math.cos(location.lat * (Pi/180)));
      locationQuery.longitude.$lte = location.lng + (radiusInDegrees * Math.cos(location.lat * (Pi/180)));
  
      locationQuery.latitude.$gte = location.lat - radiusInDegrees;
      locationQuery.latitude.$lte = location.lat + radiusInDegrees;
  
      query.location = locationQuery;
  }
  if (s !== undefined){
      query.name = new RegExp(`^${s}$`, "i");
  }
  database.Shop.find(query)
      .sort(sort)
      .limit(per_page)
      .skip((page - 1) * per_page)
      .select("name logo status rating _type location")
      .populate("logo")
      .exec((err, shops) =&gt; {
          if (err){
              res.status(500);
              return res.json({
                  status_code: 500,
                  message: "internal server error"
              });
          }
          database.Shop.count(query, (err, count) =&gt; {
              res.header("document-count", count);
              let max_pages = Math.ceil(count / per_page);
              res.header("total-pages", max_pages);
              let fullUrl = req.protocol + '://' + req.get('host') + req.baseUrl;
              let originalQS = req.query;
              originalQS.page = page;
              originalQS.per_page = per_page;
              if (page &lt; max_pages) {
                  let qs = originalQS;
                  qs.page = page + 1;
                  res.header("next-page", fullUrl + "?" + queryString.stringify(qs));
              }
              if (page &gt; 1 &amp;&amp; max_pages &gt; 0) {
                  let previous_page = page - 1;
                  if (page &gt; max_pages) {
                      previous_page = max_pages;
                  }
                  let qs = originalQS;
                  qs.page = previous_page;
                  res.header("previous-page", fullUrl + "?" + queryString.stringify(qs));
              }
              res.header("page", page);
              res.json(shops);
          });
      });
  </code></pre>