fuzzybear
fuzzybear

Reputation: 2405

MongoDB C# .Net Drivers version 2.0 location based queries

this works in 1.9

database.GetCollection<Places>("Places");
double maxDistanceInRadians = maxDistanceInMiles / 3959.0; 
var queryplaces = Query.WithinCircle("Loc", lon, lat, maxDistanceInRadians);
MongoDB.Driver.MongoCursor cursor = places.Find(queryplaces).SetLimit(limit);

How to do a location query with 2.0, Query(MongoDb.Drivers.Builder.Query) does not seem to be part of 2.0 here's the doc's

Upvotes: 3

Views: 1186

Answers (1)

Vinicius Gualberto
Vinicius Gualberto

Reputation: 639

Check this page : http://mongodb.github.io/mongo-csharp-driver/2.0/upgrading/

On the section Builders says that all The old builders (Query, Update, etc…) have all been replaced by Builders.

The builder you want is now Builders.Filter.GeoWithinPolygon

Upvotes: 4

Related Questions