title: Firebase query nearby object
body: <p>In mysql, I was using haversine formula to query nearby object. </p>
  
  <p>Using this formula
  Formula</p>
  
  <pre><code>SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance 
  FROM markers HAVING distance &lt; 25 ORDER BY distance LIMIT 0 , 20;
  </code></pre>
  
  <p>Which</p>
  
  <ul>
  <li>3959: radius of earth in miles </li>
  <li>37,-122 : given lat lng</li>
  <li>25: within 25 miles</li>
  </ul>
  
  <p>In Firebase,
  Can I store the users lat lng like what I did in mysql?
  Create a marker table. id, lat, lng columns and then use the formula to query</p>
  
  <p><strong>Updated</strong></p>
  
  <p>I should ask, what is the way to query nearby using this formula in firebase.</p>