title: Mongodb GeoSpatial Query with NodeJs (Haversine formula)
body: <p>I have a collection where I am storing 2 locations for every entry.  These locations are 
  the starting point and destination point for a particular route. I know I can write the following query to find the nearby places to query for a particular location:</p>
  
  <pre><code>exports.nearby = function(req, res){
  db.testpool.find({
      fromLoc: {
          $near: [28.423168, 77.045639],
          $maxDistance: 1
      },
  
  }).toArray(function(err, doc){
      res.send(doc);
      if(err)
          console.log(err+'');
      else
      {
          res.send(doc+'');
      }});
  </code></pre>
  
  <p>But i dont know the query which i should make in order to find the relevant routes which 
  not only match fromLoc but also the toLoc and i keep getting error When i do something like this :-</p>
  
  <pre><code>exports.nearby = function(req, res){
  db.testpool.find({
      fromLoc: {
          $near: [28.423168, 77.045639],
          $maxDistance: 1
      },
      toLoc: {
          $near: [28.649573, 77.125284],
          $maxDistance: 1
      }
  }).toArray(function(err, doc){
      res.send(doc);
      if(err)
          console.log(err+'');
      else
      {
          res.send(doc+'');
      }
  });
  </code></pre>
  
  <p>So basically I want to find out the most relevant car pools entered by users which will have 
  2 locations per entry, e.g. starting location and destination location.</p>