public void TestGeoNearSphericalFalse()
{
if (_collection.Exists()) { _collection.Drop(); }
_collection.Insert(new Place { Location = new[] { -74.0, 40.74 }, Name = "10gen", Type = "Office" });
_collection.Insert(new Place { Location = new[] { -75.0, 40.74 }, Name = "Two", Type = "Coffee" });
_collection.Insert(new Place { Location = new[] { -74.0, 41.73 }, Name = "Three", Type = "Coffee" });
_collection.CreateIndex(IndexKeys.GeoSpatial("Location"));
var options = GeoNearOptions.SetSpherical(false);
var result = _collection.GeoNearAs<Place>(Query.Null, -74.0, 40.74, 100, options);
Assert.IsTrue(result.Ok);
Assert.AreEqual(_collection.FullName, result.Namespace);
Assert.IsTrue(result.Stats.AverageDistance >= 0.0);
Assert.IsTrue(result.Stats.BTreeLocations >= 0);
Assert.IsTrue(result.Stats.Duration >= TimeSpan.Zero);
Assert.IsTrue(result.Stats.MaxDistance >= 0.0);
Assert.IsTrue(result.Stats.NumberScanned >= 0);
Assert.IsTrue(result.Stats.ObjectsLoaded >= 0);
Assert.AreEqual(3, result.Hits.Count);
var hit0 = result.Hits[0];
Assert.IsTrue(hit0.Distance == 0.0);
Assert.AreEqual(-74.0, hit0.RawDocument["Location"][0].AsDouble);
Assert.AreEqual(40.74, hit0.RawDocument["Location"][1].AsDouble);
Assert.AreEqual("10gen", hit0.RawDocument["Name"].AsString);
Assert.AreEqual("Office", hit0.RawDocument["Type"].AsString);
// with spherical false "Three" is slightly closer than "Two"
var hit1 = result.Hits[1];
Assert.IsTrue(hit1.Distance > 0.0);
Assert.AreEqual(-74.0, hit1.RawDocument["Location"][0].AsDouble);
Assert.AreEqual(41.73, hit1.RawDocument["Location"][1].AsDouble);
Assert.AreEqual("Three", hit1.RawDocument["Name"].AsString);
Assert.AreEqual("Coffee", hit1.RawDocument["Type"].AsString);
var hit2 = result.Hits[2];
Assert.IsTrue(hit2.Distance > 0.0);
Assert.IsTrue(hit2.Distance > hit1.Distance);
Assert.AreEqual(-75.0, hit2.RawDocument["Location"][0].AsDouble);
Assert.AreEqual(40.74, hit2.RawDocument["Location"][1].AsDouble);
Assert.AreEqual("Two", hit2.RawDocument["Name"].AsString);
Assert.AreEqual("Coffee", hit2.RawDocument["Type"].AsString);
}