IndexKeysDefinition<BravoPoint> keys = "{ Location: \"2dsphere\" }"; var indexModel = new CreateIndexModel<BravoPoint>(keys); var s = collection.Indexes.CreateOne(indexModel);
最後可以得出Result
1 2 3 4
var gp = new GeoJsonPoint<GeoJson2DGeographicCoordinates> (new GeoJson2DGeographicCoordinates(121.575163, 25.078124)); var query = Builders<BravoPoint>.Filter.Near("Location", gp, 10000); var result = collection.Find(query).ToList();