title: Calculate distance in Java Using MongoDB
body: <p>I am working on location calculation in Java and MongoDB. I pass latitude and longitude to method and find nearest location from provided input. I am able to get Location name from my master table where i have all landmarks with latitude and longitude.</p>
  
  <p>My requirement is that i want to get location with distance using MongoDB - like 4Km from XYZ .
  MongoDB has Geospatial query and i am working on it. I can get mentioned input by running in command prompt by using db.runCommand({ geoNear : "data", near : [-73.9000, 40.7000], spherical : true, maxDistance : 2500/6378137, distanceMultiplier: 6378137}).</p>
  
  <p>I am looking equivalent code in Java, so i can pass latitude and longitude only and get nearest location with distance.</p>
  
  <p>Thanks in advance.</p>