After upgrading MongoDb to 2.6.1 in my System n i get sometimes the following error:
Legacy point is out of bounds for spherical query
ErrorCode 17444
Here: https://github.com/mongodb/mongo/blob/master/src/mongo/db/geo/geoquery.cpp#L73 I can see that this is raised by mongo db due to some invalid data.
// The user-provided point can be flat. We need to make sure that it's in bounds.
if (isNearSphere) {
uassert(17444,
"Legacy point is out of bounds for spherical query",
centroid.flatUpgradedToSphere || (SPHERE == centroid.crs));
}
But currently i can't figure why and how to prevent it.
My Code looks like this:
IEnumerable<BsonValue> cids = companyIds.ToBsonValueArray();
return Collection.Find(
Query.And(
Query.In("CompanyId", cids),
Query.Near("Location", location.Geography.Longitude, location.Geography.Latitude, location.Radius / 6371000, true))).ToList();
Stacktrace:
QueryFailure flag was Legacy point is out of bounds for spherical query (response was { "$err" : "Legacy point is out of bounds for spherical query", "code" : 17444 }). at MongoDB.Driver.Internal.MongoReplyMessage
1.ReadFrom(BsonBuffer buffer, IBsonSerializationOptions serializationOptions) at MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument](BsonBinaryReaderSettings readerSettings, IBsonSerializer serializer, IBsonSerializationOptions serializationOptions) at MongoDB.Driver.Operations.QueryOperation
1.GetFirstBatch(IConnectionProvider connectionProvider)