public void TestFindWithinCircleSphericalTrue()
{
if (_server.BuildInfo.Version >= new Version(1, 7, 0, 0))
{
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 query = Query.WithinCircle("Location", -74.0, 40.74, 0.1, true); // spherical
var hits = _collection.Find(query).ToArray();
Assert.AreEqual(3, hits.Length);
// note: the hits are unordered
query = Query.WithinCircle("Location", -74.0, 40.74, 0.01, false); // smaller radius
hits = _collection.Find(query).ToArray();
Assert.AreEqual(1, hits.Length);
query = Query.WithinCircle("Location", -174.0, 40.74, 0.1, false); // different part of the world
hits = _collection.Find(query).ToArray();
Assert.AreEqual(0, hits.Length);
}
}