Table of Contents

Class QueryBuilder<TDocument>

Namespace
MongoDB.Driver.Builders
Assembly
MongoDB.Driver.Legacy.dll

Aids in building mongo queries based on type information.

public class QueryBuilder<TDocument>

Type Parameters

TDocument

The type of the document.

Inheritance
QueryBuilder<TDocument>
Inherited Members
Extension Methods

Constructors

QueryBuilder()

Initializes a new instance of the QueryBuilder<TDocument> class.

public QueryBuilder()

Methods

All<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, IEnumerable<TValue>)

Tests that the named array element contains all of the values (see $all).

public IMongoQuery All<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, IEnumerable<TValue> values)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

values IEnumerable<TValue>

The values to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the enumerable member values.

And(params IMongoQuery[])

Tests that all the queries are true (see $and in newer versions of the server).

public IMongoQuery And(params IMongoQuery[] queries)

Parameters

queries IMongoQuery[]

A list of subqueries.

Returns

IMongoQuery

An IMongoQuery.

And(IEnumerable<IMongoQuery>)

Tests that all the queries are true (see $and in newer versions of the server).

public IMongoQuery And(IEnumerable<IMongoQuery> queries)

Parameters

queries IEnumerable<IMongoQuery>

A list of subqueries.

Returns

IMongoQuery

An IMongoQuery.

BitsAllClear(Expression<Func<TDocument, object>>, long)

Tests that the value of the named element has all of the specified bits clear.

public IMongoQuery BitsAllClear(Expression<Func<TDocument, object>> memberExpression, long bitmask)

Parameters

memberExpression Expression<Func<TDocument, object>>

The member expression.

bitmask long

The bitmask.

Returns

IMongoQuery

An IMongoQuery.

BitsAllSet(Expression<Func<TDocument, object>>, long)

Tests that the value of the named element has all of the specified bits set.

public IMongoQuery BitsAllSet(Expression<Func<TDocument, object>> memberExpression, long bitmask)

Parameters

memberExpression Expression<Func<TDocument, object>>

The member expression.

bitmask long

The bitmask.

Returns

IMongoQuery

An IMongoQuery.

BitsAnyClear(Expression<Func<TDocument, object>>, long)

Tests that the value of the named element has any of the specified bits clear.

public IMongoQuery BitsAnyClear(Expression<Func<TDocument, object>> memberExpression, long bitmask)

Parameters

memberExpression Expression<Func<TDocument, object>>

The member expression.

bitmask long

The bitmask.

Returns

IMongoQuery

An IMongoQuery.

BitsAnySet(Expression<Func<TDocument, object>>, long)

Tests that the value of the named element has any of the specified bits set.

public IMongoQuery BitsAnySet(Expression<Func<TDocument, object>> memberExpression, long bitmask)

Parameters

memberExpression Expression<Func<TDocument, object>>

The member expression.

bitmask long

The bitmask.

Returns

IMongoQuery

An IMongoQuery.

EQ<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that any of the values in the named array element is equal to some value.

public IMongoQuery EQ<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

EQ<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that the value of the named element is equal to some value.

public IMongoQuery EQ<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

value TMember

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

ElemMatch<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, Func<QueryBuilder<TValue>, IMongoQuery>)

Tests that at least one item of the named array element matches a query (see $elemMatch).

public IMongoQuery ElemMatch<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, Func<QueryBuilder<TValue>, IMongoQuery> elementQueryBuilderFunction)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

elementQueryBuilderFunction Func<QueryBuilder<TValue>, IMongoQuery>

A function that builds a query using the supplied query builder.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the enumerable member values.

Exists<TMember>(Expression<Func<TDocument, TMember>>)

Tests that an element of that name does or does not exist (see $exists).

public IMongoQuery Exists<TMember>(Expression<Func<TDocument, TMember>> memberExpression)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

GTE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that any of the values in the named array element is greater than or equal to some value (see $gte).

public IMongoQuery GTE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

GTE<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that the value of the named element is greater than or equal to some value (see $gte).

public IMongoQuery GTE<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

value TMember

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

GT<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that any of the values in the named array element is greater than some value (see $lt).

public IMongoQuery GT<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

GT<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that the value of the named element is greater than some value (see $gt).

public IMongoQuery GT<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

value TMember

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

GeoIntersects<TMember, TCoordinates>(Expression<Func<TDocument, TMember>>, GeoJsonGeometry<TCoordinates>)

Tests that a location element specified by name intersects with the geometry (see $geoIntersects).

public IMongoQuery GeoIntersects<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonGeometry<TCoordinates> geometry) where TCoordinates : GeoJsonCoordinates

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

geometry GeoJsonGeometry<TCoordinates>

The geometry.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The type of the member.

TCoordinates

The type of the coordinates.

In<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, IEnumerable<TValue>)

Tests that any of the values in the named array element are equal to one of a list of values (see $in).

public IMongoQuery In<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, IEnumerable<TValue> values)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

values IEnumerable<TValue>

The values to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the enumerable member values.

In<TMember>(Expression<Func<TDocument, TMember>>, IEnumerable<TMember>)

Tests that the value of the named element is equal to one of a list of values (see $in).

public IMongoQuery In<TMember>(Expression<Func<TDocument, TMember>> memberExpression, IEnumerable<TMember> values)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

values IEnumerable<TMember>

The values to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

LTE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that any of the values in the named array element is less than or equal to some value (see $lte).

public IMongoQuery LTE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

LTE<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that the value of the named element is less than or equal to some value (see $lte).

public IMongoQuery LTE<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

value TMember

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

LT<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that any of the values in the named array element is less than some value (see $lt).

public IMongoQuery LT<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

LT<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that the value of the named element is less than some value (see $lt).

public IMongoQuery LT<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

value TMember

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Matches(Expression<Func<TDocument, IEnumerable<string>>>, BsonRegularExpression)

Tests that any of the values in the named array element matches a regular expression (see $regex).

public IMongoQuery Matches(Expression<Func<TDocument, IEnumerable<string>>> memberExpression, BsonRegularExpression regex)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<string>>>

The member expression representing the element to test.

regex BsonRegularExpression

The regex.

Returns

IMongoQuery

A query.

Matches(Expression<Func<TDocument, string>>, BsonRegularExpression)

Tests that the value of the named element matches a regular expression (see $regex).

public IMongoQuery Matches(Expression<Func<TDocument, string>> memberExpression, BsonRegularExpression regex)

Parameters

memberExpression Expression<Func<TDocument, string>>

The member expression representing the element to test.

regex BsonRegularExpression

The regex.

Returns

IMongoQuery

A query.

Mod(Expression<Func<TDocument, IEnumerable<int>>>, long, long)

Tests that the any of the values in the named array element match some value (see $mod).

public IMongoQuery Mod(Expression<Func<TDocument, IEnumerable<int>>> memberExpression, long modulus, long value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<int>>>

The member expression representing the element to test.

modulus long

The modulus.

value long

The value.

Returns

IMongoQuery

An IMongoQuery.

Mod(Expression<Func<TDocument, int>>, long, long)

Tests that the modulus of the value of the named element matches some value (see $mod).

public IMongoQuery Mod(Expression<Func<TDocument, int>> memberExpression, long modulus, long value)

Parameters

memberExpression Expression<Func<TDocument, int>>

The member expression representing the element to test.

modulus long

The modulus.

value long

The value.

Returns

IMongoQuery

An IMongoQuery.

NE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, TValue)

Tests that none of the values in the named array element is equal to some value (see $ne).

public IMongoQuery NE<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, TValue value)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

value TValue

The value to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

NE<TMember>(Expression<Func<TDocument, TMember>>, TMember)

Tests that an element does not equal the value (see $ne).

public IMongoQuery NE<TMember>(Expression<Func<TDocument, TMember>> memberExpression, TMember value)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

value TMember

The value.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Near<TMember>(Expression<Func<TDocument, TMember>>, double, double)

Tests that the value of the named element is near some location (see $near).

public IMongoQuery Near<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double x, double y)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

x double

The x value of the origin.

y double

The y value of the origin.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Near<TMember>(Expression<Func<TDocument, TMember>>, double, double, double)

Tests that the value of the named element is near some location (see $near).

public IMongoQuery Near<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double x, double y, double maxDistance)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

x double

The x value of the origin.

y double

The y value of the origin.

maxDistance double

The max distance.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Near<TMember>(Expression<Func<TDocument, TMember>>, double, double, double, bool)

Tests that the value of the named element is near some location (see $near).

public IMongoQuery Near<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double x, double y, double maxDistance, bool spherical)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

x double

The x value of the origin.

y double

The y value of the origin.

maxDistance double

The max distance.

spherical bool

if set to true [spherical].

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>>, GeoJsonPoint<TCoordinates>)

Tests that the value of the named element is near a point (see $near).

public IMongoQuery Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPoint<TCoordinates> point) where TCoordinates : GeoJsonCoordinates

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

point GeoJsonPoint<TCoordinates>

The point.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The type of the member.

TCoordinates

The type of the coordinates.

Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>>, GeoJsonPoint<TCoordinates>, double)

Tests that the value of the named element is near some location (see $near).

public IMongoQuery Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPoint<TCoordinates> point, double maxDistance) where TCoordinates : GeoJsonCoordinates

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

point GeoJsonPoint<TCoordinates>

The point.

maxDistance double

The max distance.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

TCoordinates

The type of the coordinates.

Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>>, GeoJsonPoint<TCoordinates>, double, bool)

Tests that the value of the named element is near some location (see $near).

public IMongoQuery Near<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPoint<TCoordinates> point, double maxDistance, bool spherical) where TCoordinates : GeoJsonCoordinates

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

point GeoJsonPoint<TCoordinates>

The point.

maxDistance double

The max distance.

spherical bool

if set to true then the query will be translated to $nearSphere.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

TCoordinates

The type of the coordinates.

Not(IMongoQuery)

Tests that the inverse of the query is true (see $not).

public IMongoQuery Not(IMongoQuery query)

Parameters

query IMongoQuery

The query.

Returns

IMongoQuery

An IMongoQuery.

NotExists<TMember>(Expression<Func<TDocument, TMember>>)

Tests that an element of that name does not exist (see $exists).

public IMongoQuery NotExists<TMember>(Expression<Func<TDocument, TMember>> memberExpression)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

NotIn<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, IEnumerable<TValue>)

Tests that the none of the values of the named array element is equal to any item in a list of values (see $nin).

public IMongoQuery NotIn<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, IEnumerable<TValue> values)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression.

values IEnumerable<TValue>

The values to compare.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the enumerable member values.

NotIn<TMember>(Expression<Func<TDocument, TMember>>, IEnumerable<TMember>)

Tests that the value of the named element is not equal to any item in a list of values (see $nin).

public IMongoQuery NotIn<TMember>(Expression<Func<TDocument, TMember>> memberExpression, IEnumerable<TMember> values)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

values IEnumerable<TMember>

The values to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Or(params IMongoQuery[])

Tests that at least one of the subqueries is true (see $or).

public IMongoQuery Or(params IMongoQuery[] queries)

Parameters

queries IMongoQuery[]

The subqueries.

Returns

IMongoQuery

A query.

Or(IEnumerable<IMongoQuery>)

Tests that at least one of the subqueries is true (see $or).

public IMongoQuery Or(IEnumerable<IMongoQuery> queries)

Parameters

queries IEnumerable<IMongoQuery>

The subqueries.

Returns

IMongoQuery

A query.

Size<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, int)

Tests that the size of the named array is equal to some value (see $size).

public IMongoQuery Size<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, int size)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

size int

The size to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the enumerable member values.

Type<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, BsonType)

Tests that any of the values in the named array element is equal to some type (see $type).

public IMongoQuery Type<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, BsonType type)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

type BsonType

The type to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

Type<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>>, string)

Tests that any of the values in the named array element is equal to some type (see $type).

public IMongoQuery Type<TValue>(Expression<Func<TDocument, IEnumerable<TValue>>> memberExpression, string type)

Parameters

memberExpression Expression<Func<TDocument, IEnumerable<TValue>>>

The member expression representing the element to test.

type string

The type to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TValue

The type of the value.

Type<TMember>(Expression<Func<TDocument, TMember>>, BsonType)

Tests that the type of the named element is equal to some type (see $type).

public IMongoQuery Type<TMember>(Expression<Func<TDocument, TMember>> memberExpression, BsonType type)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

type BsonType

The type to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Type<TMember>(Expression<Func<TDocument, TMember>>, string)

Tests that the type of the named element is equal to some type (see $type).

public IMongoQuery Type<TMember>(Expression<Func<TDocument, TMember>> memberExpression, string type)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

type string

The type to compare to.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Where(Expression<Func<TDocument, bool>>)

Builds a query from an expression.

public IMongoQuery Where(Expression<Func<TDocument, bool>> expression)

Parameters

expression Expression<Func<TDocument, bool>>

The expression.

Returns

IMongoQuery

An IMongoQuery.

WithinCircle<TMember>(Expression<Func<TDocument, TMember>>, double, double, double)

Tests that the value of the named element is within a circle (see $within and $center).

public IMongoQuery WithinCircle<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double centerX, double centerY, double radius)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

centerX double

The x coordinate of the origin.

centerY double

The y coordinate of the origin.

radius double

The radius of the circle.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

WithinCircle<TMember>(Expression<Func<TDocument, TMember>>, double, double, double, bool)

Tests that the value of the named element is within a circle (see $within and $center).

public IMongoQuery WithinCircle<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double centerX, double centerY, double radius, bool spherical)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

centerX double

The x coordinate of the origin.

centerY double

The y coordinate of the origin.

radius double

The radius of the circle.

spherical bool

if set to true [spherical].

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

WithinPolygon<TMember>(Expression<Func<TDocument, TMember>>, double[,])

Tests that the value of the named element is within a polygon (see $within and $polygon).

public IMongoQuery WithinPolygon<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double[,] points)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

points double[,]

An array of points that defines the polygon (the second dimension must be of length 2).

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

WithinRectangle<TMember>(Expression<Func<TDocument, TMember>>, double, double, double, double)

Tests that the value of the named element is within a rectangle (see $within and $box).

public IMongoQuery WithinRectangle<TMember>(Expression<Func<TDocument, TMember>> memberExpression, double lowerLeftX, double lowerLeftY, double upperRightX, double upperRightY)

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression representing the element to test.

lowerLeftX double

The x coordinate of the lower left corner.

lowerLeftY double

The y coordinate of the lower left corner.

upperRightX double

The x coordinate of the upper right corner.

upperRightY double

The y coordinate of the upper right corner.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The member type.

Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>>, GeoJsonPolygon<TCoordinates>)

Tests that the value of the named element is within the specified geometry (see $within).

public IMongoQuery Within<TMember, TCoordinates>(Expression<Func<TDocument, TMember>> memberExpression, GeoJsonPolygon<TCoordinates> polygon) where TCoordinates : GeoJsonCoordinates

Parameters

memberExpression Expression<Func<TDocument, TMember>>

The member expression.

polygon GeoJsonPolygon<TCoordinates>

The polygon.

Returns

IMongoQuery

An IMongoQuery.

Type Parameters

TMember

The type of the member.

TCoordinates

The type of the coordinates.