class Expr (View source)

Fluent interface for building query and update expressions.

Properties

protected string $query The query criteria array.
protected array $newObj The "new object" array containing either a full document or a number of atomic update operators.
protected string $currentField The current field we are operating on.

Methods

$this
addAnd(array|Expr $expression)

Add one or more $and clauses to the current query.

$this
addManyToSet(array $values) deprecated

Append multiple values to the current array field only if they do not already exist in the array.

$this
addNor(array|Expr $expression)

Add one or more $nor clauses to the current query.

$this
addOr(array|Expr $expression)

Add one or more $or clauses to the current query.

$this
addToSet(mixed|Expr $valueOrExpression)

Append one or more values to the current array field only if they do not already exist in the array.

$this
all(array $values)

Specify $all criteria for the current field.

$this
bit(string $operator, int $value)

Apply a bitwise operation on the current field

$this
bitAnd(int $value)

Apply a bitwise and operation on the current field.

$this
bitOr(int $value)

Apply a bitwise or operation on the current field.

$this
bitsAllClear(int|array|MongoBinData $value)

Matches documents where all of the bit positions given by the query are clear.

$this
bitsAllSet(int|array|MongoBinData $value)

Matches documents where all of the bit positions given by the query are set.

$this
bitsAnyClear(int|array|MongoBinData $value)

Matches documents where any of the bit positions given by the query are clear.

$this
bitsAnySet(int|array|MongoBinData $value)

Matches documents where any of the bit positions given by the query are set.

$this
bitXor(int $value)

Apply a bitwise xor operation on the current field.

$this
caseSensitive(bool $caseSensitive)

A boolean flag to enable or disable case sensitive search for $text criteria.

$this
comment(string $comment)

Associates a comment to any expression taking a query predicate.

$this
currentDate(string $type = 'date')

Sets the value of the current field to the current date, either as a date or a timestamp.

$this
diacriticSensitive(bool $diacriticSensitive)

A boolean flag to enable or disable diacritic sensitive search for $text criteria.

$this
each(array $values)

Add $each criteria to the expression for a $push operation.

$this
elemMatch(array|Expr $expression)

Specify $elemMatch criteria for the current field.

$this
equals(mixed $value)

Specify an equality match for the current field.

$this
exists(boolean $bool)

Specify $exists criteria for the current field.

$this
field(string $field)

Set the current field for building the expression.

$this
geoIntersects(array|Geometry $geometry)

Add $geoIntersects criteria with a GeoJSON geometry to the expression.

$this
geoWithin(array|Geometry $geometry)

Add $geoWithin criteria with a GeoJSON geometry to the expression.

$this
geoWithinBox(float $x1, float $y1, float $x2, float $y2)

Add $geoWithin criteria with a $box shape to the expression.

$this
geoWithinCenter(float $x, float $y, float $radius)

Add $geoWithin criteria with a $center shape to the expression.

$this
geoWithinCenterSphere(float $x, float $y, float $radius)

Add $geoWithin criteria with a $centerSphere shape to the expression.

$this
geoWithinPolygon()

Add $geoWithin criteria with a $polygon shape to the expression.

string
getCurrentField()

Return the current field.

array
getNewObj()

Return the "new object".

$this
setNewObj(array $newObj)

Set the "new object".

array
getQuery()

Return the query criteria.

$this
setQuery(array $query)

Set the query criteria.

$this
gt(mixed $value)

Specify $gt criteria for the current field.

$this
gte(mixed $value)

Specify $gte criteria for the current field.

$this
in(array $values)

Specify $in criteria for the current field.

$this
inc(float|integer $value)

Increment the current field.

$this
language(string $language)

Set the $language option for $text criteria.

$this
lt(mixed $value)

Specify $lt criteria for the current field.

$this
lte(mixed $value)

Specify $lte criteria for the current field.

$this
max(mixed $value)

Updates the value of the field to a specified value if the specified value is greater than the current value of the field.

$this
maxDistance(float $maxDistance)

Set the $maxDistance option for $near or $nearSphere criteria.

$this
min(mixed $value)

Updates the value of the field to a specified value if the specified value is less than the current value of the field.

$this
minDistance(float $minDistance)

Set the $minDistance option for $near or $nearSphere criteria.

$this
mod(float|integer $divisor, float|integer $remainder = 0)

Specify $mod criteria for the current field.

$this
mul(float|integer $value)

Multiply the current field.

$this
near(float|array|Point $x, float $y = null)

Add $near criteria to the expression.

$this
nearSphere(float|array|Point $x, float $y = null)

Add $nearSphere criteria to the expression.

$this
not(array|Expr $expression)

Negates an expression for the current field.

$this
notEqual(mixed $value)

Specify $ne criteria for the current field.

$this
notIn(array $values)

Specify $nin criteria for the current field.

$this
operator(string $operator, mixed $value)

Defines an operator and value on the expression.

$this
popFirst()

Remove the first element from the current array field.

$this
popLast()

Remove the last element from the current array field.

$this
position(integer $position)

Add $position criteria to the expression for a $push operation.

$this
pull(mixed|Expr $valueOrExpression)

Remove all elements matching the given value or expression from the current array field.

$this
pullAll(array $values)

Remove all elements matching any of the given values from the current array field.

$this
push(mixed|Expr $valueOrExpression)

Append one or more values to the current array field.

$this
pushAll(array $values)

Append multiple values to the current array field.

$this
range(mixed $start, mixed $end)

Specify $gte and $lt criteria for the current field.

$this
rename(string $name)

Rename the current field.

$this
set(mixed $value, boolean $atomic = true)

Set the current field to a value.

$this
setOnInsert(mixed $value)

Set the current field to the value if the document is inserted in an upsert operation.

$this
size(integer $size)

Specify $size criteria for the current field.

$this
slice(integer $slice)

Add $slice criteria to the expression for a $push operation.

$this
sort(array|string $fieldName, int|string $order = null)

Add $sort criteria to the expression for a $push operation.

$this
text(string $search)

Specify $text criteria for the current query.

$this
type(integer $type)

Specify $type criteria for the current field.

$this
unsetField()

Unset the current field.

$this
where(string|MongoCode $javascript)

Specify a JavaScript expression to use for matching documents.

$this
withinBox(float $x1, float $y1, float $x2, float $y2) deprecated

Add $within criteria with a $box shape to the expression.

$this
withinCenter(float $x, float $y, float $radius) deprecated

Add $within criteria with a $center shape to the expression.

$this
withinCenterSphere(float $x, float $y, float $radius) deprecated

Add $within criteria with a $centerSphere shape to the expression.

$this
withinPolygon() deprecated

Add $within criteria with a $polygon shape to the expression.

Details

$this addAnd(array|Expr $expression)

Add one or more $and clauses to the current query.

Parameters

array|Expr $expression

Return Value

$this

See also

Builder::addAnd
http://docs.mongodb.org/manual/reference/operator/and/

$this addManyToSet(array $values) deprecated

deprecated 1.1 Use {@link Expr::addToSet()} with {@link Expr::each()}; Will be removed in 2.0

Append multiple values to the current array field only if they do not already exist in the array.

If the field does not exist, it will be set to an array containing the unique values in the argument. If the field is not an array, the query will yield an error.

$this addNor(array|Expr $expression)

Add one or more $nor clauses to the current query.

Parameters

array|Expr $expression

Return Value

$this

See also

Builder::addNor
http://docs.mongodb.org/manual/reference/operator/nor/

$this addOr(array|Expr $expression)

Add one or more $or clauses to the current query.

Parameters

array|Expr $expression

Return Value

$this

See also

Builder::addOr
http://docs.mongodb.org/manual/reference/operator/or/

$this addToSet(mixed|Expr $valueOrExpression)

Append one or more values to the current array field only if they do not already exist in the array.

If the field does not exist, it will be set to an array containing the unique value(s) in the argument. If the field is not an array, the query will yield an error.

Multiple values may be specified by provided an Expr object and using {@link Expr::each()}.

$this all(array $values)

Specify $all criteria for the current field.

Parameters

array $values

Return Value

$this

See also

Builder::all
http://docs.mongodb.org/manual/reference/operator/all/

protected $this bit(string $operator, int $value)

Apply a bitwise operation on the current field

Parameters

string $operator
int $value

Return Value

$this

See also

http://docs.mongodb.org/manual/reference/operator/update/bit/

$this bitAnd(int $value)

Apply a bitwise and operation on the current field.

Parameters

int $value

Return Value

$this

See also

Builder::bitAnd
http://docs.mongodb.org/manual/reference/operator/update/bit/

$this bitOr(int $value)

Apply a bitwise or operation on the current field.

Parameters

int $value

Return Value

$this

See also

Builder::bitOr
http://docs.mongodb.org/manual/reference/operator/update/bit/

$this bitsAllClear(int|array|MongoBinData $value)

Matches documents where all of the bit positions given by the query are clear.

Parameters

int|array|MongoBinData $value

Return Value

$this

See also

Builder::bitsAllClear
https://docs.mongodb.org/manual/reference/operator/query/bitsAllClear/

$this bitsAllSet(int|array|MongoBinData $value)

Matches documents where all of the bit positions given by the query are set.

Parameters

int|array|MongoBinData $value

Return Value

$this

See also

Builder::bitsAllSet
https://docs.mongodb.org/manual/reference/operator/query/bitsAllSet/

$this bitsAnyClear(int|array|MongoBinData $value)

Matches documents where any of the bit positions given by the query are clear.

Parameters

int|array|MongoBinData $value

Return Value

$this

See also

Builder::bitsAnyClear
https://docs.mongodb.org/manual/reference/operator/query/bitsAnyClear/

$this bitsAnySet(int|array|MongoBinData $value)

Matches documents where any of the bit positions given by the query are set.

Parameters

int|array|MongoBinData $value

Return Value

$this

See also

Builder::bitsAnySet
https://docs.mongodb.org/manual/reference/operator/query/bitsAnySet/

$this bitXor(int $value)

Apply a bitwise xor operation on the current field.

Parameters

int $value

Return Value

$this

See also

Builder::bitXor
http://docs.mongodb.org/manual/reference/operator/update/bit/

$this caseSensitive(bool $caseSensitive)

A boolean flag to enable or disable case sensitive search for $text criteria.

This method must be called after text().

Parameters

bool $caseSensitive

Return Value

$this

Exceptions

BadMethodCallException if the query does not already have $text criteria

See also

Builder::caseSensitive
http://docs.mongodb.org/manual/reference/operator/text/

$this comment(string $comment)

Associates a comment to any expression taking a query predicate.

Parameters

string $comment

Return Value

$this

See also

Builder::comment
http://docs.mongodb.org/manual/reference/operator/query/comment/

$this currentDate(string $type = 'date')

Sets the value of the current field to the current date, either as a date or a timestamp.

Parameters

string $type

Return Value

$this

Exceptions

InvalidArgumentException if an invalid type is given

See also

Builder::currentDate
http://docs.mongodb.org/manual/reference/operator/update/currentDate/

$this diacriticSensitive(bool $diacriticSensitive)

A boolean flag to enable or disable diacritic sensitive search for $text criteria.

This method must be called after text().

Parameters

bool $diacriticSensitive

Return Value

$this

Exceptions

BadMethodCallException if the query does not already have $text criteria

See also

Builder::diacriticSensitive
http://docs.mongodb.org/manual/reference/operator/text/

$this each(array $values)

Add $each criteria to the expression for a $push operation.

Parameters

array $values

Return Value

$this

See also

Expr::push
http://docs.mongodb.org/manual/reference/operator/each/

$this elemMatch(array|Expr $expression)

Specify $elemMatch criteria for the current field.

Parameters

array|Expr $expression

Return Value

$this

See also

Builder::elemMatch
http://docs.mongodb.org/manual/reference/operator/elemMatch/

$this equals(mixed $value)

Specify an equality match for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::equals

$this exists(boolean $bool)

Specify $exists criteria for the current field.

Parameters

boolean $bool

Return Value

$this

See also

Builder::exists
http://docs.mongodb.org/manual/reference/operator/exists/

$this field(string $field)

Set the current field for building the expression.

Parameters

string $field

Return Value

$this

See also

Builder::field

$this geoIntersects(array|Geometry $geometry)

Add $geoIntersects criteria with a GeoJSON geometry to the expression.

The geometry parameter GeoJSON object or an array corresponding to the geometry's JSON representation.

Parameters

array|Geometry $geometry

Return Value

$this

See also

Builder::geoIntersects
http://docs.mongodb.org/manual/reference/operator/geoIntersects/

$this geoWithin(array|Geometry $geometry)

Add $geoWithin criteria with a GeoJSON geometry to the expression.

The geometry parameter GeoJSON object or an array corresponding to the geometry's JSON representation.

Parameters

array|Geometry $geometry

Return Value

$this

See also

Builder::geoWithin
http://docs.mongodb.org/manual/reference/operator/geoIntersects/

$this geoWithinBox(float $x1, float $y1, float $x2, float $y2)

Add $geoWithin criteria with a $box shape to the expression.

A rectangular polygon will be constructed from a pair of coordinates corresponding to the bottom left and top right corners.

Note: the $box operator only supports legacy coordinate pairs and 2d indexes. This cannot be used with 2dsphere indexes and GeoJSON shapes.

Parameters

float $x1
float $y1
float $x2
float $y2

Return Value

$this

See also

Builder::geoWithinBox
http://docs.mongodb.org/manual/reference/operator/box/

$this geoWithinCenter(float $x, float $y, float $radius)

Add $geoWithin criteria with a $center shape to the expression.

Note: the $center operator only supports legacy coordinate pairs and 2d indexes. This cannot be used with 2dsphere indexes and GeoJSON shapes.

Parameters

float $x
float $y
float $radius

Return Value

$this

See also

Builider::geoWithinCenter()
http://docs.mongodb.org/manual/reference/operator/center/

$this geoWithinCenterSphere(float $x, float $y, float $radius)

Add $geoWithin criteria with a $centerSphere shape to the expression.

Note: the $centerSphere operator supports both 2d and 2dsphere indexes.

Parameters

float $x
float $y
float $radius

Return Value

$this

See also

Builder::geoWithinCenterSphere
http://docs.mongodb.org/manual/reference/operator/centerSphere/

$this geoWithinPolygon()

Add $geoWithin criteria with a $polygon shape to the expression.

Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates).

The last point coordinate is implicitly connected with the first.

Note: the $polygon operator only supports legacy coordinate pairs and 2d indexes. This cannot be used with 2dsphere indexes and GeoJSON shapes.

Return Value

$this

Exceptions

InvalidArgumentException if less than three points are given

See also

Builder::geoWithinPolygon
http://docs.mongodb.org/manual/reference/operator/polygon/

string getCurrentField()

Return the current field.

Return Value

string

array getNewObj()

Return the "new object".

Return Value

array

See also

Builder::getNewObj

$this setNewObj(array $newObj)

Set the "new object".

Parameters

array $newObj

Return Value

$this

See also

Builder::setNewObj

array getQuery()

Return the query criteria.

Return Value

array

See also

Builder::getQueryArray

$this setQuery(array $query)

Set the query criteria.

Parameters

array $query

Return Value

$this

See also

Builder::setQueryArray

$this gt(mixed $value)

Specify $gt criteria for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::gt
http://docs.mongodb.org/manual/reference/operator/gt/

$this gte(mixed $value)

Specify $gte criteria for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::gte
http://docs.mongodb.org/manual/reference/operator/gte/

$this in(array $values)

Specify $in criteria for the current field.

Parameters

array $values

Return Value

$this

See also

Builder::in
http://docs.mongodb.org/manual/reference/operator/in/

$this inc(float|integer $value)

Increment the current field.

If the field does not exist, it will be set to this value.

Parameters

float|integer $value

Return Value

$this

See also

Builder::inc
http://docs.mongodb.org/manual/reference/operator/inc/

$this language(string $language)

Set the $language option for $text criteria.

This method must be called after text().

Parameters

string $language

Return Value

$this

Exceptions

BadMethodCallException if the query does not already have $text criteria

See also

Builder::language
http://docs.mongodb.org/manual/reference/operator/text/

$this lt(mixed $value)

Specify $lt criteria for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::lte
http://docs.mongodb.org/manual/reference/operator/lte/

$this lte(mixed $value)

Specify $lte criteria for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::lte
http://docs.mongodb.org/manual/reference/operator/lte/

$this max(mixed $value)

Updates the value of the field to a specified value if the specified value is greater than the current value of the field.

Parameters

mixed $value

Return Value

$this

See also

Builder::max
http://docs.mongodb.org/manual/reference/operator/update/max/

$this maxDistance(float $maxDistance)

Set the $maxDistance option for $near or $nearSphere criteria.

This method must be called after near() or nearSphere(), since placement of the $maxDistance option depends on whether a GeoJSON point or legacy coordinates were provided for $near/$nearSphere.

Parameters

float $maxDistance

Return Value

$this

Exceptions

BadMethodCallException if the query does not already have $near or $nearSphere criteria

See also

http://docs.mongodb.org/manual/reference/operator/maxDistance/

$this min(mixed $value)

Updates the value of the field to a specified value if the specified value is less than the current value of the field.

Parameters

mixed $value

Return Value

$this

See also

Builder::min
http://docs.mongodb.org/manual/reference/operator/update/min/

$this minDistance(float $minDistance)

Set the $minDistance option for $near or $nearSphere criteria.

This method must be called after near() or nearSphere(), since placement of the $minDistance option depends on whether a GeoJSON point or legacy coordinates were provided for $near/$nearSphere.

Parameters

float $minDistance

Return Value

$this

Exceptions

BadMethodCallException if the query does not already have $near or $nearSphere criteria

See also

http://docs.mongodb.org/manual/reference/operator/minDistance/

$this mod(float|integer $divisor, float|integer $remainder = 0)

Specify $mod criteria for the current field.

Parameters

float|integer $divisor
float|integer $remainder

Return Value

$this

See also

Builder::mod
http://docs.mongodb.org/manual/reference/operator/mod/

$this mul(float|integer $value)

Multiply the current field.

If the field does not exist, it will be set to 0.

Parameters

float|integer $value

Return Value

$this

See also

Builder::mul
http://docs.mongodb.org/manual/reference/operator/mul/

$this near(float|array|Point $x, float $y = null)

Add $near criteria to the expression.

A GeoJSON point may be provided as the first and only argument for 2dsphere queries. This single parameter may be a GeoJSON point object or an array corresponding to the point's JSON representation.

Parameters

float|array|Point $x
float $y

Return Value

$this

See also

Builder::near
http://docs.mongodb.org/manual/reference/operator/near/

$this nearSphere(float|array|Point $x, float $y = null)

Add $nearSphere criteria to the expression.

A GeoJSON point may be provided as the first and only argument for 2dsphere queries. This single parameter may be a GeoJSON point object or an array corresponding to the point's JSON representation.

Parameters

float|array|Point $x
float $y

Return Value

$this

See also

Builder::nearSphere
http://docs.mongodb.org/manual/reference/operator/nearSphere/

$this not(array|Expr $expression)

Negates an expression for the current field.

Parameters

array|Expr $expression

Return Value

$this

See also

Builder::not
http://docs.mongodb.org/manual/reference/operator/not/

$this notEqual(mixed $value)

Specify $ne criteria for the current field.

Parameters

mixed $value

Return Value

$this

See also

Builder::notEqual
http://docs.mongodb.org/manual/reference/operator/ne/

$this notIn(array $values)

Specify $nin criteria for the current field.

Parameters

array $values

Return Value

$this

See also

Builder::notIn
http://docs.mongodb.org/manual/reference/operator/nin/

$this operator(string $operator, mixed $value)

Defines an operator and value on the expression.

If there is a current field, the operator will be set on it; otherwise, the operator is set at the top level of the query.

Parameters

string $operator
mixed $value

Return Value

$this

$this popFirst()

Remove the first element from the current array field.

$this popLast()

Remove the last element from the current array field.

$this position(integer $position)

Add $position criteria to the expression for a $push operation.

This is useful in conjunction with {@link Expr::each()} for a {@link Expr::push()} operation.

Parameters

integer $position

Return Value

$this

See also

http://docs.mongodb.org/manual/reference/operator/update/position/

$this pull(mixed|Expr $valueOrExpression)

Remove all elements matching the given value or expression from the current array field.

Parameters

mixed|Expr $valueOrExpression

Return Value

$this

See also

Builder::pull
http://docs.mongodb.org/manual/reference/operator/pull/

$this pullAll(array $values)

Remove all elements matching any of the given values from the current array field.

Parameters

array $values

Return Value

$this

See also

Builder::pullAll
http://docs.mongodb.org/manual/reference/operator/pullAll/

$this push(mixed|Expr $valueOrExpression)

Append one or more values to the current array field.

If the field does not exist, it will be set to an array containing the value(s) in the argument. If the field is not an array, the query will yield an error.

Multiple values may be specified by providing an Expr object and using {@link Expr::each()}. {@link Expr::slice()} and {@link Expr::sort()} may also be used to limit and order array elements, respectively.

$this pushAll(array $values)

Append multiple values to the current array field.

If the field does not exist, it will be set to an array containing the values in the argument. If the field is not an array, the query will yield an error.

This operator is deprecated in MongoDB 2.4. {@link Expr::push()} and {@link Expr::each()} should be used in its place.

Parameters

array $values

Return Value

$this

See also

Builder::pushAll
http://docs.mongodb.org/manual/reference/operator/pushAll/

$this range(mixed $start, mixed $end)

Specify $gte and $lt criteria for the current field.

This method is shorthand for specifying $gte criteria on the lower bound and $lt criteria on the upper bound. The upper bound is not inclusive.

Parameters

mixed $start
mixed $end

Return Value

$this

See also

Builder::range

$this rename(string $name)

Rename the current field.

Parameters

string $name

Return Value

$this

See also

Builder::rename
http://docs.mongodb.org/manual/reference/operator/rename/

$this set(mixed $value, boolean $atomic = true)

Set the current field to a value.

This is only relevant for insert, update, or findAndUpdate queries. For update and findAndUpdate queries, the $atomic parameter will determine whether or not a $set operator is used.

Parameters

mixed $value
boolean $atomic

Return Value

$this

See also

Builder::set
http://docs.mongodb.org/manual/reference/operator/set/

$this setOnInsert(mixed $value)

Set the current field to the value if the document is inserted in an upsert operation.

If an update operation with upsert: true results in an insert of a document, then $setOnInsert assigns the specified values to the fields in the document. If the update operation does not result in an insert, $setOnInsert does nothing.

$this size(integer $size)

Specify $size criteria for the current field.

Parameters

integer $size

Return Value

$this

See also

Builder::size
http://docs.mongodb.org/manual/reference/operator/size/

$this slice(integer $slice)

Add $slice criteria to the expression for a $push operation.

This is useful in conjunction with {@link Expr::each()} for a {@link Expr::push()} operation. {@link Builder::selectSlice()} should be used for specifying $slice for a query projection.

Parameters

integer $slice

Return Value

$this

See also

http://docs.mongodb.org/manual/reference/operator/slice/

$this sort(array|string $fieldName, int|string $order = null)

Add $sort criteria to the expression for a $push operation.

If sorting by multiple fields, the first argument should be an array of field name (key) and order (value) pairs.

This is useful in conjunction with {@link Expr::each()} for a {@link Expr::push()} operation. {@link Builder::sort()} should be used to sort the results of a query.

Parameters

array|string $fieldName Field name or array of field/order pairs
int|string $order Field order (if one field is specified)

Return Value

$this

See also

http://docs.mongodb.org/manual/reference/operator/sort/

$this text(string $search)

Specify $text criteria for the current query.

The $language option may be set with {@link Expr::language()}.

Parameters

string $search

Return Value

$this

See also

Builder::text
http://docs.mongodb.org/master/reference/operator/query/text/

$this type(integer $type)

Specify $type criteria for the current field.

Parameters

integer $type

Return Value

$this

See also

Builder::type
http://docs.mongodb.org/manual/reference/operator/type/

$this unsetField()

Unset the current field.

The field will be removed from the document (not set to null).

$this where(string|MongoCode $javascript)

Specify a JavaScript expression to use for matching documents.

Parameters

string|MongoCode $javascript

Return Value

$this

See also

Builder::where
http://docs.mongodb.org/manual/reference/operator/where/

$this withinBox(float $x1, float $y1, float $x2, float $y2) deprecated

deprecated 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin

Add $within criteria with a $box shape to the expression.

Parameters

float $x1
float $y1
float $x2
float $y2

Return Value

$this

See also

Expr::geoWithinBox
http://docs.mongodb.org/manual/reference/operator/box/

$this withinCenter(float $x, float $y, float $radius) deprecated

deprecated 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin

Add $within criteria with a $center shape to the expression.

Parameters

float $x
float $y
float $radius

Return Value

$this

See also

Expr::geoWithinCenter
http://docs.mongodb.org/manual/reference/operator/center/

$this withinCenterSphere(float $x, float $y, float $radius) deprecated

deprecated 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin

Add $within criteria with a $centerSphere shape to the expression.

Parameters

float $x
float $y
float $radius

Return Value

$this

See also

Expr::geoWithinCenterSphere
http://docs.mongodb.org/manual/reference/operator/centerSphere/

$this withinPolygon() deprecated

deprecated 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin

Add $within criteria with a $polygon shape to the expression.

Point coordinates are in x, y order (easting, northing for projected coordinates, longitude, latitude for geographic coordinates).

The last point coordinate is implicitly connected with the first.

Return Value

$this

Exceptions

InvalidArgumentException if less than three points are given

See also

Expr::geoWithinPolygon
http://docs.mongodb.org/manual/reference/operator/polygon/