public static IMongoQuery GeoQuery(MongoLocation loc, double prox, IMongoQuery query) { var locQuery = QueryConstants.GeoQuery(loc, prox); var q = new QueryDocument(); q.AddRange(BsonDocument.Parse(locQuery.ToString())); if (query != null) q.AddRange(BsonDocument.Parse(query.ToString())); return q; }
public static IMongoQuery GeoQuery(MongoLocation loc, double prox) { if (prox == 0) throw new ArgumentException("Proximity can not be zero"); prox = prox / 69; return Query.Near("loc", loc.Longitude, loc.Latitude, prox); }