Skip to content

Commit d1fcdf2

Browse files
committed
updated test and some doc comments.
1 parent f85dc86 commit d1fcdf2

File tree

2 files changed

+15
-20
lines changed

2 files changed

+15
-20
lines changed

MongoDB.Driver/Builders/QueryBuilder.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -694,21 +694,21 @@ public static IMongoQuery Where(BsonJavaScript javascript)
694694
/// </summary>
695695
/// <typeparam name="TCoordinates">The type of the coordinates.</typeparam>
696696
/// <param name="name">The name of the element to test.</param>
697-
/// <param name="geometry">The geometry.</param>
697+
/// <param name="polygon">The polygon.</param>
698698
/// <returns>An IMongoQuery.</returns>
699-
public static IMongoQuery Within<TCoordinates>(string name, GeoJsonPolygon<TCoordinates> geometry)
699+
public static IMongoQuery Within<TCoordinates>(string name, GeoJsonPolygon<TCoordinates> polygon)
700700
where TCoordinates : GeoJsonCoordinates
701701
{
702702
if (name == null)
703703
{
704704
throw new ArgumentNullException("name");
705705
}
706-
if (geometry == null)
706+
if (polygon == null)
707707
{
708-
throw new ArgumentNullException("geometry");
708+
throw new ArgumentNullException("polygon");
709709
}
710710

711-
var geoDoc = new BsonDocument("$geometry", BsonDocumentWrapper.Create(geometry));
711+
var geoDoc = new BsonDocument("$geometry", BsonDocumentWrapper.Create(polygon));
712712
var condition = new BsonDocument("$within", geoDoc);
713713

714714
return new QueryDocument(name, condition);
@@ -1317,12 +1317,12 @@ public static IMongoQuery Where(Expression<Func<TDocument, bool>> expression)
13171317
/// <typeparam name="TMember">The type of the member.</typeparam>
13181318
/// <typeparam name="TCoordinates">The type of the coordinates.</typeparam>
13191319
/// <param name="memberExpression">The member expression.</param>
1320-
/// <param name="geometry">The geometry.</param>
1320+
/// <param name="polygon">The polygon.</param>
13211321
/// <returns>An IMongoQuery.</returns>
1322-
public static IMongoQuery Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPolygon<TCoordinates> geometry)
1322+
public static IMongoQuery Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPolygon<TCoordinates> polygon)
13231323
where TCoordinates : GeoJsonCoordinates
13241324
{
1325-
return new QueryBuilder<TDocument>().Within(memberExpression, geometry);
1325+
return new QueryBuilder<TDocument>().Within(memberExpression, polygon);
13261326
}
13271327

13281328
/// <summary>
@@ -2182,22 +2182,22 @@ public IMongoQuery Where(Expression<Func<TDocument, bool>> expression)
21822182
/// <typeparam name="TMember">The type of the member.</typeparam>
21832183
/// <typeparam name="TCoordinates">The type of the coordinates.</typeparam>
21842184
/// <param name="memberExpression">The member expression.</param>
2185-
/// <param name="geometry">The geometry.</param>
2185+
/// <param name="polygon">The polygon.</param>
21862186
/// <returns>An IMongoQuery.</returns>
2187-
public IMongoQuery Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPolygon<TCoordinates> geometry)
2187+
public IMongoQuery Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPolygon<TCoordinates> polygon)
21882188
where TCoordinates : GeoJsonCoordinates
21892189
{
21902190
if (memberExpression == null)
21912191
{
21922192
throw new ArgumentNullException("memberExpression");
21932193
}
2194-
if (geometry == null)
2194+
if (polygon == null)
21952195
{
2196-
throw new ArgumentNullException("geometry");
2196+
throw new ArgumentNullException("polygon");
21972197
}
21982198

21992199
var serializationInfo = _serializationInfoHelper.GetSerializationInfo(memberExpression);
2200-
return Query.Within(serializationInfo.ElementName, geometry);
2200+
return Query.Within(serializationInfo.ElementName, polygon);
22012201
}
22022202

22032203
/// <summary>

MongoDB.DriverUnitTests/MongoCollectionTests.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -903,13 +903,8 @@ public void TestGeoSphericalIndex()
903903
_collection.CreateIndex(IndexKeys.GeoSpatialSpherical("Location"));
904904

905905
// TODO: add Query builder support for 2dsphere queries
906-
var query = new QueryDocument {
907-
{ "Location", new BsonDocument {
908-
{ "$near", new BsonDocument {
909-
{ "$geometry", GeoJson.Point(GeoJson.Geographic(-74.0, 40.74)).ToBsonDocument() }
910-
} }
911-
} }
912-
};
906+
var query = Query<PlaceGeoJson>.Near(x => x.Location, GeoJson.Point(GeoJson.Geographic(-74.0, 40.74)));
907+
913908
var cursor = _collection.FindAs<PlaceGeoJson>(query);
914909
var hits = cursor.ToArray();
915910

0 commit comments

Comments
 (0)