PHP Class Doctrine\MongoDB\Query\Builder

Since: 1.0
Author: Jonathan H. Wage ([email protected])
Exibir arquivo Open project: doctrine/mongodb Class Usage Examples

Protected Properties

Property Type Description
$collection Doctrine\MongoDB\Collection The Collection instance.
$expr Expr This object includes the query criteria and the "new object" used for insert and update queries.
$query array Array containing the query data.

Public Methods

Method Description
__clone ( )
__construct ( Doctrine\MongoDB\Collection $collection ) Create a new query builder.
addAnd ( array | Expr $expression ) Add one or more $and clauses to the current query.
addManyToSet ( array $values ) Append multiple values to the current array field only if they do not already exist in the array.
addNor ( array | Expr $expression ) Add one or more $nor clauses to the current query.
addOr ( array | Expr $expression ) Add one or more $or clauses to the current query.
addToSet ( mixed | Expr $valueOrExpression ) Append one or more values to the current array field only if they do not already exist in the array.
all ( array $values ) Specify $all criteria for the current field.
bitAnd ( integer $value ) Apply a bitwise and operation on the current field.
bitOr ( integer $value ) Apply a bitwise or operation on the current field.
bitXor ( integer $value ) Apply a bitwise xor operation on the current field.
bitsAllClear ( integer | array | MongoBinData $value ) Matches documents where all of the bit positions given by the query are clear.
bitsAllSet ( integer | array | MongoBinData $value ) Matches documents where all of the bit positions given by the query are set.
bitsAnyClear ( integer | array | MongoBinData $value ) Matches documents where any of the bit positions given by the query are clear.
bitsAnySet ( integer | array | MongoBinData $value ) Matches documents where any of the bit positions given by the query are set.
caseSensitive ( boolean $caseSensitive ) A boolean flag to enable or disable case sensitive search for $text criteria.
comment ( string $comment ) Associates a comment to any expression taking a query predicate.
count ( ) Change the query type to count.
currentDate ( string $type = 'date' ) Sets the value of the current field to the current date, either as a date or a timestamp.
debug ( string $name = null ) : mixed Return an array of information about the Builder state for debugging.
diacriticSensitive ( boolean $diacriticSensitive ) A boolean flag to enable or disable diacritic sensitive search for $text criteria.
distanceMultiplier ( float $distanceMultiplier ) Set the "distanceMultiplier" option for a geoNear command query.
distinct ( string $field ) Change the query type to a distinct command.
eagerCursor ( boolean $bool = true ) Set whether the query should return its result as an EagerCursor.
elemMatch ( array | Expr $expression ) Specify $elemMatch criteria for the current field.
equals ( mixed $value ) Specify an equality match for the current field.
exclude ( $fieldName = null ) Set one or more fields to be excluded from the query projection.
exists ( boolean $bool ) Specify $exists criteria for the current field.
expr ( ) : Expr Create a new Expr instance that can be used to build partial expressions for other operator methods.
field ( string $field ) Set the current field for building the expression.
finalize ( string | MongoCode $finalize ) Set the "finalize" option for a mapReduce or group command.
find ( ) Change the query type to find.
findAndRemove ( ) Change the query type to findAndRemove (uses the findAndModify command).
findAndUpdate ( ) Change the query type to findAndUpdate (uses the findAndModify command).
geoIntersects ( array | GeoJson\Geometry\Geometry $geometry ) Add $geoIntersects criteria with a GeoJSON geometry to the query.
geoNear ( float | array | GeoJson\Geometry\Point $x, float $y = null ) Change the query type to a geoNear command.
geoWithin ( array | GeoJson\Geometry\Geometry $geometry ) Add $geoWithin criteria with a GeoJSON geometry to the query.
geoWithinBox ( float $x1, float $y1, float $x2, float $y2 ) Add $geoWithin criteria with a $box shape to the query.
geoWithinCenter ( float $x, float $y, float $radius ) Add $geoWithin criteria with a $center shape to the query.
geoWithinCenterSphere ( float $x, float $y, float $radius ) Add $geoWithin criteria with a $centerSphere shape to the query.
geoWithinPolygon ( ) Add $geoWithin criteria with a $polygon shape to the query.
getNewObj ( ) : array Return the expression's "new object".
getQuery ( array $options = [] ) : Query Create a new Query instance from the Builder state.
getQueryArray ( ) : array Return the expression's query criteria.
getType ( ) : integer Get the type of this query.
group ( mixed $keys, array $initial, string | MongoCode $reduce = null, array $options = [] ) Change the query type to a group command.
gt ( mixed $value ) Specify $gt criteria for the current field.
gte ( mixed $value ) Specify $gte criteria for the current field.
hint ( array | string $index ) Set the index hint for the query.
immortal ( boolean $bool = true ) Set the immortal cursor flag.
in ( array $values ) Specify $in criteria for the current field.
inc ( float | integer $value ) Increment the current field.
insert ( ) Change the query type to insert.
language ( string $language ) Set the $language option for $text criteria.
limit ( integer $limit ) Set the limit for the query.
lt ( mixed $value ) Specify $lt criteria for the current field.
lte ( mixed $value ) Specify $lte criteria for the current field.
map ( string | MongoCode $map ) Change the query type to a mapReduce command.
mapReduce ( string | MongoCode $map, string | MongoCode $reduce, array | string $out = ['inline' => true], array $options = [] ) Change the query type to a mapReduce command.
mapReduceOptions ( array $options ) Set additional options for a mapReduce command.
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.
maxDistance ( float $maxDistance ) Set the "maxDistance" option for a geoNear command query or add $maxDistance criteria to the query.
maxTimeMS ( integer $ms ) Specifies a cumulative time limit in milliseconds for processing operations on a cursor.
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.
minDistance ( float $minDistance ) Set the "minDistance" option for a geoNear command query or add $minDistance criteria to the query.
mod ( float | integer $divisor, float | integer $remainder ) Specify $mod criteria for the current field.
mul ( float | integer $value ) Multiply the current field.
multiple ( boolean $bool = true ) Set the "multiple" option for an update query.
near ( float | array | GeoJson\Geometry\Point $x, float $y = null ) Add $near criteria to the query.
nearSphere ( float | array | GeoJson\Geometry\Point $x, float $y = null ) Add $nearSphere criteria to the query.
not ( array | Expr $expression ) Negates an expression for the current field.
notEqual ( mixed $value ) Specify $ne criteria for the current field.
notIn ( array $values ) Specify $nin criteria for the current field.
out ( array | string $out ) Set the "out" option for a mapReduce command.
popFirst ( ) Remove the first element from the current array field.
popLast ( ) Remove the last element from the current array field.
pull ( mixed | Expr $valueOrExpression ) Remove all elements matching the given value or expression from the current array field.
pullAll ( array $values ) Remove all elements matching any of the given values from the current array field.
push ( mixed | Expr $valueOrExpression ) Append one or more values to the current array field.
pushAll ( array $values ) Append multiple values to the current array field.
range ( mixed $start, mixed $end ) Specify $gte and $lt criteria for the current field.
reduce ( string | MongoCode $reduce ) Set the "reduce" option for a mapReduce or group command.
remove ( ) Change the query type to remove.
rename ( string $name ) Rename the current field.
returnNew ( boolean $bool = true ) Set the "new" option for a findAndUpdate command.
select ( $fieldName = null ) Set one or more fields to be included in the query projection.
selectElemMatch ( string $fieldName, array | Expr $expression ) Select only matching embedded documents in an array field for the query projection.
selectMeta ( string $fieldName, string $metaDataKeyword ) Select a metadata field for the query projection.
selectSlice ( string $fieldName, integer $countOrSkip, integer $limit = null ) Select a slice of an array field for the query projection.
set ( mixed $value, boolean $atomic = true ) Set the current field to a value.
setNewObj ( array $newObj ) Set the expression's "new object".
setOnInsert ( mixed $value ) Set the current field to the value if the document is inserted in an upsert operation.
setQueryArray ( array $query ) Set the expression's query criteria.
setReadPreference ( $readPreference, array $tags = null ) Set the read preference for the query.
size ( integer $size ) Specify $size criteria for the current field.
skip ( integer $skip ) Set the skip for the query cursor.
slaveOkay ( boolean $bool = true ) Set whether the query may be directed to replica set secondaries.
snapshot ( boolean $bool = true ) Set the snapshot cursor flag.
sort ( array | string $fieldName, integer | string $order = 1 ) Set one or more field/order pairs on which to sort the query.
sortMeta ( string $fieldName, string $metaDataKeyword ) Specify a projected metadata field on which to sort the query.
spherical ( boolean $spherical = true ) Set the "spherical" option for a geoNear command query.
text ( string $search ) Specify $text criteria for the current field.
type ( integer $type ) Specify $type criteria for the current field.
unsetField ( ) Unset the current field.
update ( ) Change the query type to update.
updateMany ( ) Change the query type to update multiple documents
updateOne ( ) Change the query type to update a single document
upsert ( boolean $bool = true ) Set the "upsert" option for an update or findAndUpdate query.
where ( string | MongoCode $javascript ) Specify a JavaScript expression to use for matching documents.
withinBox ( float $x1, float $y1, float $x2, float $y2 ) Add $within criteria with a $box shape to the query.
withinCenter ( float $x, float $y, float $radius ) Add $within criteria with a $center shape to the query.
withinCenterSphere ( float $x, float $y, float $radius ) Add $within criteria with a $centerSphere shape to the query.
withinPolygon ( ) Add $within criteria with a $polygon shape to the query.

Method Details

__clone() public method

See also: http://php.net/manual/en/language.oop5.cloning.php
public __clone ( )

__construct() public method

Create a new query builder.
public __construct ( Doctrine\MongoDB\Collection $collection )
$collection Doctrine\MongoDB\Collection

addAnd() public method

You can create a new expression using the {@link Builder::expr()} method.
See also: Expr::addAnd()
See also: http://docs.mongodb.org/manual/reference/operator/and/
public addAnd ( array | Expr $expression )
$expression array | Expr

addManyToSet() public method

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.
See also: Expr::addManyToSet()
See also: http://docs.mongodb.org/manual/reference/operator/addToSet/
See also: http://docs.mongodb.org/manual/reference/operator/each/
Deprecation: 1.1 Use {@link Builder::addToSet()} with {@link Expr::each()}; Will be removed in 2.0
public addManyToSet ( array $values )
$values array

addNor() public method

You can create a new expression using the {@link Builder::expr()} method.
See also: Expr::addNor()
See also: http://docs.mongodb.org/manual/reference/operator/nor/
public addNor ( array | Expr $expression )
$expression array | Expr

addOr() public method

You can create a new expression using the {@link Builder::expr()} method.
See also: Expr::addOr()
See also: http://docs.mongodb.org/manual/reference/operator/or/
public addOr ( array | Expr $expression )
$expression array | Expr

addToSet() public method

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()}.
See also: Expr::addToSet()
See also: http://docs.mongodb.org/manual/reference/operator/addToSet/
See also: http://docs.mongodb.org/manual/reference/operator/each/
public addToSet ( mixed | Expr $valueOrExpression )
$valueOrExpression mixed | Expr

all() public method

Specify $all criteria for the current field.
See also: Expr::all()
See also: http://docs.mongodb.org/manual/reference/operator/all/
public all ( array $values )
$values array

bitAnd() public method

Apply a bitwise and operation on the current field.
See also: Expr::bitAnd()
See also: http://docs.mongodb.org/manual/reference/operator/update/bit/
public bitAnd ( integer $value )
$value integer

bitOr() public method

Apply a bitwise or operation on the current field.
See also: Expr::bitOr()
See also: http://docs.mongodb.org/manual/reference/operator/update/bit/
public bitOr ( integer $value )
$value integer

bitXor() public method

Apply a bitwise xor operation on the current field.
See also: Expr::bitXor()
See also: http://docs.mongodb.org/manual/reference/operator/update/bit/
public bitXor ( integer $value )
$value integer

bitsAllClear() public method

Matches documents where all of the bit positions given by the query are clear.
See also: Expr::bitsAllClear()
See also: https://docs.mongodb.org/manual/reference/operator/query/bitsAllClear/
public bitsAllClear ( integer | array | MongoBinData $value )
$value integer | array | MongoBinData

bitsAllSet() public method

Matches documents where all of the bit positions given by the query are set.
See also: Expr::bitsAllSet()
See also: https://docs.mongodb.org/manual/reference/operator/query/bitsAllSet/
public bitsAllSet ( integer | array | MongoBinData $value )
$value integer | array | MongoBinData

bitsAnyClear() public method

Matches documents where any of the bit positions given by the query are clear.
See also: Expr::bitsAnyClear()
See also: https://docs.mongodb.org/manual/reference/operator/query/bitsAnyClear/
public bitsAnyClear ( integer | array | MongoBinData $value )
$value integer | array | MongoBinData

bitsAnySet() public method

Matches documents where any of the bit positions given by the query are set.
See also: Expr::bitsAnySet()
See also: https://docs.mongodb.org/manual/reference/operator/query/bitsAnySet/
public bitsAnySet ( integer | array | MongoBinData $value )
$value integer | array | MongoBinData

caseSensitive() public method

This method must be called after text().
See also: Expr::caseSensitive()
See also: http://docs.mongodb.org/manual/reference/operator/text/
Since: 1.3
public caseSensitive ( boolean $caseSensitive )
$caseSensitive boolean

comment() public method

Associates a comment to any expression taking a query predicate.
See also: Expr::comment()
See also: http://docs.mongodb.org/manual/reference/operator/query/comment/
public comment ( string $comment )
$comment string

count() public method

Change the query type to count.
public count ( )

currentDate() public method

Sets the value of the current field to the current date, either as a date or a timestamp.
See also: Expr::currentDate()
See also: http://docs.mongodb.org/manual/reference/operator/currentDate/
public currentDate ( string $type = 'date' )
$type string

debug() public method

The $name parameter may be used to return a specific key from the internal $query array property. If omitted, the entire array will be returned.
public debug ( string $name = null ) : mixed
$name string
return mixed

diacriticSensitive() public method

This method must be called after text().
See also: Builder::diacriticSensitive()
See also: http://docs.mongodb.org/manual/reference/operator/text/
Since: 1.3
public diacriticSensitive ( boolean $diacriticSensitive )
$diacriticSensitive boolean

distanceMultiplier() public method

Set the "distanceMultiplier" option for a geoNear command query.
public distanceMultiplier ( float $distanceMultiplier )
$distanceMultiplier float

distinct() public method

Change the query type to a distinct command.
See also: http://docs.mongodb.org/manual/reference/command/distinct/
public distinct ( string $field )
$field string

eagerCursor() public method

Set whether the query should return its result as an EagerCursor.
public eagerCursor ( boolean $bool = true )
$bool boolean

elemMatch() public method

You can create a new expression using the {@link Builder::expr()} method.
See also: Expr::elemMatch()
See also: http://docs.mongodb.org/manual/reference/operator/elemMatch/
public elemMatch ( array | Expr $expression )
$expression array | Expr

equals() public method

Specify an equality match for the current field.
See also: Expr::equals()
public equals ( mixed $value )
$value mixed

exclude() public method

If fields have been selected for inclusion, only the "_id" field may be excluded.
public exclude ( $fieldName = null )

exists() public method

Specify $exists criteria for the current field.
See also: Expr::exists()
See also: http://docs.mongodb.org/manual/reference/operator/exists/
public exists ( boolean $bool )
$bool boolean

expr() public method

Create a new Expr instance that can be used to build partial expressions for other operator methods.
public expr ( ) : Expr
return Expr $expr

field() public method

Set the current field for building the expression.
See also: Expr::field()
public field ( string $field )
$field string

finalize() public method

Set the "finalize" option for a mapReduce or group command.
public finalize ( string | MongoCode $finalize )
$finalize string | MongoCode

find() public method

Change the query type to find.
public find ( )

findAndRemove() public method

Change the query type to findAndRemove (uses the findAndModify command).
See also: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findAndRemove ( )

findAndUpdate() public method

Change the query type to findAndUpdate (uses the findAndModify command).
See also: http://docs.mongodb.org/manual/reference/command/findAndModify/
public findAndUpdate ( )

geoIntersects() public method

The geometry parameter GeoJSON object or an array corresponding to the geometry's JSON representation.
See also: Expr::geoIntersects()
See also: http://docs.mongodb.org/manual/reference/operator/geoIntersects/
public geoIntersects ( array | GeoJson\Geometry\Geometry $geometry )
$geometry array | GeoJson\Geometry\Geometry

geoNear() public method

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. If GeoJSON is used, the "spherical" option will default to true. This method sets the "near" option for the geoNear command. The "num" option may be set using {@link Expr::limit()}. The "distanceMultiplier", "maxDistance", "minDistance", and "spherical" options may be set using their respective builder methods. Additional query criteria will be assigned to the "query" option.
See also: http://docs.mongodb.org/manual/reference/command/geoNear/
public geoNear ( float | array | GeoJson\Geometry\Point $x, float $y = null )
$x float | array | GeoJson\Geometry\Point
$y float

geoWithin() public method

The geometry parameter GeoJSON object or an array corresponding to the geometry's JSON representation.
See also: Expr::geoWithin()
See also: http://docs.mongodb.org/manual/reference/operator/geoWithin/
public geoWithin ( array | GeoJson\Geometry\Geometry $geometry )
$geometry array | GeoJson\Geometry\Geometry

geoWithinBox() public method

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.
See also: Expr::geoWithinBox()
See also: http://docs.mongodb.org/manual/reference/operator/box/
public geoWithinBox ( float $x1, float $y1, float $x2, float $y2 )
$x1 float
$y1 float
$x2 float
$y2 float

geoWithinCenter() public method

Note: the $center operator only supports legacy coordinate pairs and 2d indexes. This cannot be used with 2dsphere indexes and GeoJSON shapes.
See also: Expr::geoWithinCenter()
See also: http://docs.mongodb.org/manual/reference/operator/center/
public geoWithinCenter ( float $x, float $y, float $radius )
$x float
$y float
$radius float

geoWithinCenterSphere() public method

Note: the $centerSphere operator supports both 2d and 2dsphere indexes.
See also: Expr::geoWithinCenterSphere()
See also: http://docs.mongodb.org/manual/reference/operator/centerSphere/
public geoWithinCenterSphere ( float $x, float $y, float $radius )
$x float
$y float
$radius float

geoWithinPolygon() public method

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.
See also: Expr::geoWithinPolygon()
See also: http://docs.mongodb.org/manual/reference/operator/polygon/
public geoWithinPolygon ( )

getNewObj() public method

Return the expression's "new object".
See also: Expr::getNewObj()
public getNewObj ( ) : array
return array

getQuery() public method

Create a new Query instance from the Builder state.
public getQuery ( array $options = [] ) : Query
$options array
return Query

getQueryArray() public method

Return the expression's query criteria.
See also: Expr::getQuery()
public getQueryArray ( ) : array
return array

getType() public method

Get the type of this query.
public getType ( ) : integer
return integer $type

group() public method

If the "reduce" option is not specified when calling this method, it must be set with the {@link Builder::reduce()} method.
See also: http://docs.mongodb.org/manual/reference/command/group/
public group ( mixed $keys, array $initial, string | MongoCode $reduce = null, array $options = [] )
$keys mixed
$initial array
$reduce string | MongoCode
$options array

gt() public method

Specify $gt criteria for the current field.
See also: Expr::gt()
See also: http://docs.mongodb.org/manual/reference/operator/gt/
public gt ( mixed $value )
$value mixed

gte() public method

Specify $gte criteria for the current field.
See also: Expr::gte()
See also: http://docs.mongodb.org/manual/reference/operator/gte/
public gte ( mixed $value )
$value mixed

hint() public method

Set the index hint for the query.
public hint ( array | string $index )
$index array | string

immortal() public method

Set the immortal cursor flag.
public immortal ( boolean $bool = true )
$bool boolean

in() public method

Specify $in criteria for the current field.
See also: Expr::in()
See also: http://docs.mongodb.org/manual/reference/operator/in/
public in ( array $values )
$values array

inc() public method

If the field does not exist, it will be set to this value.
See also: Expr::inc()
See also: http://docs.mongodb.org/manual/reference/operator/inc/
public inc ( float | integer $value )
$value float | integer

insert() public method

Change the query type to insert.
public insert ( )

language() public method

This method must be called after text().
See also: Expr::language()
See also: http://docs.mongodb.org/manual/reference/operator/text/
public language ( string $language )
$language string

limit() public method

This is only relevant for find queries and geoNear and mapReduce commands.
See also: Query::prepareCursor()
public limit ( integer $limit )
$limit integer

lt() public method

Specify $lt criteria for the current field.
See also: Expr::lte()
See also: http://docs.mongodb.org/manual/reference/operator/lte/
public lt ( mixed $value )
$value mixed

lte() public method

Specify $lte criteria for the current field.
See also: Expr::lte()
See also: http://docs.mongodb.org/manual/reference/operator/lte/
public lte ( mixed $value )
$value mixed

map() public method

The "reduce" option is not specified when calling this method; it must be set with the {@link Builder::reduce()} method. The "out" option defaults to inline, like {@link Builder::mapReduce()}.
See also: http://docs.mongodb.org/manual/reference/command/mapReduce/
public map ( string | MongoCode $map )
$map string | MongoCode

mapReduce() public method

Change the query type to a mapReduce command.
See also: http://docs.mongodb.org/manual/reference/command/mapReduce/
public mapReduce ( string | MongoCode $map, string | MongoCode $reduce, array | string $out = ['inline' => true], array $options = [] )
$map string | MongoCode
$reduce string | MongoCode
$out array | string
$options array

mapReduceOptions() public method

Set additional options for a mapReduce command.
public mapReduceOptions ( array $options )
$options array

max() public method

Updates the value of the field to a specified value if the specified value is greater than the current value of the field.
See also: Expr::max()
See also: http://docs.mongodb.org/manual/reference/operator/update/max/
public max ( mixed $value )
$value mixed

maxDistance() public method

If the query is a geoNear command ({@link Expr::geoNear()} was called), the "maxDistance" command option will be set; otherwise, $maxDistance will be added to the current expression. If the query uses GeoJSON points, $maxDistance will be interpreted in meters. If legacy point coordinates are used, $maxDistance will be interpreted in radians.
See also: Expr::maxDistance()
See also: http://docs.mongodb.org/manual/reference/command/geoNear/
See also: http://docs.mongodb.org/manual/reference/operator/maxDistance/
See also: http://docs.mongodb.org/manual/reference/operator/near/
See also: http://docs.mongodb.org/manual/reference/operator/nearSphere/
public maxDistance ( float $maxDistance )
$maxDistance float

maxTimeMS() public method

Specifies a cumulative time limit in milliseconds for processing operations on a cursor.
public maxTimeMS ( integer $ms )
$ms integer

min() public method

Updates the value of the field to a specified value if the specified value is less than the current value of the field.
See also: Expr::min()
See also: http://docs.mongodb.org/manual/reference/operator/update/min/
public min ( mixed $value )
$value mixed

minDistance() public method

If the query is a geoNear command ({@link Expr::geoNear()} was called), the "minDistance" command option will be set; otherwise, $minDistance will be added to the current expression. If the query uses GeoJSON points, $minDistance will be interpreted in meters. If legacy point coordinates are used, $minDistance will be interpreted in radians.
See also: Expr::minDistance()
See also: http://docs.mongodb.org/manual/reference/command/geoNear/
See also: http://docs.mongodb.org/manual/reference/operator/minDistance/
See also: http://docs.mongodb.org/manual/reference/operator/near/
See also: http://docs.mongodb.org/manual/reference/operator/nearSphere/
public minDistance ( float $minDistance )
$minDistance float

mod() public method

Specify $mod criteria for the current field.
See also: Expr::mod()
See also: http://docs.mongodb.org/manual/reference/operator/mod/
public mod ( float | integer $divisor, float | integer $remainder )
$divisor float | integer
$remainder float | integer

mul() public method

If the field does not exist, it will be set to 0.
See also: Expr::mul()
See also: http://docs.mongodb.org/manual/reference/operator/mul/
public mul ( float | integer $value )
$value float | integer

multiple() public method

Set the "multiple" option for an update query.
Deprecation: Deprecated in version 1.4 - use updateOne or updateMany instead
public multiple ( boolean $bool = true )
$bool boolean

near() public method

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.
See also: Expr::near()
See also: http://docs.mongodb.org/manual/reference/operator/near/
public near ( float | array | GeoJson\Geometry\Point $x, float $y = null )
$x float | array | GeoJson\Geometry\Point
$y float

nearSphere() public method

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.
See also: Expr::nearSphere()
See also: http://docs.mongodb.org/manual/reference/operator/nearSphere/
public nearSphere ( float | array | GeoJson\Geometry\Point $x, float $y = null )
$x float | array | GeoJson\Geometry\Point
$y float

not() public method

You can create a new expression using the {@link Builder::expr()} method.
See also: Expr::not()
See also: http://docs.mongodb.org/manual/reference/operator/not/
public not ( array | Expr $expression )
$expression array | Expr

notEqual() public method

Specify $ne criteria for the current field.
See also: Expr::notEqual()
See also: http://docs.mongodb.org/manual/reference/operator/ne/
public notEqual ( mixed $value )
$value mixed

notIn() public method

Specify $nin criteria for the current field.
See also: Expr::notIn()
See also: http://docs.mongodb.org/manual/reference/operator/nin/
public notIn ( array $values )
$values array

out() public method

Set the "out" option for a mapReduce command.
public out ( array | string $out )
$out array | string

popFirst() public method

Remove the first element from the current array field.
See also: Expr::popFirst()
See also: http://docs.mongodb.org/manual/reference/operator/pop/
public popFirst ( )

popLast() public method

Remove the last element from the current array field.
See also: Expr::popLast()
See also: http://docs.mongodb.org/manual/reference/operator/pop/
public popLast ( )

pull() public method

Remove all elements matching the given value or expression from the current array field.
See also: Expr::pull()
See also: http://docs.mongodb.org/manual/reference/operator/pull/
public pull ( mixed | Expr $valueOrExpression )
$valueOrExpression mixed | Expr

pullAll() public method

Remove all elements matching any of the given values from the current array field.
See also: Expr::pullAll()
See also: http://docs.mongodb.org/manual/reference/operator/pullAll/
public pullAll ( array $values )
$values array

push() public method

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.
See also: Expr::push()
See also: http://docs.mongodb.org/manual/reference/operator/push/
See also: http://docs.mongodb.org/manual/reference/operator/each/
See also: http://docs.mongodb.org/manual/reference/operator/slice/
See also: http://docs.mongodb.org/manual/reference/operator/sort/
public push ( mixed | Expr $valueOrExpression )
$valueOrExpression mixed | Expr

pushAll() public method

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 Builder::push()} and {@link Expr::each()} should be used in its place.
See also: Expr::pushAll()
See also: http://docs.mongodb.org/manual/reference/operator/pushAll/
public pushAll ( array $values )
$values array

range() public method

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.
See also: Expr::range()
public range ( mixed $start, mixed $end )
$start mixed
$end mixed

reduce() public method

Set the "reduce" option for a mapReduce or group command.
public reduce ( string | MongoCode $reduce )
$reduce string | MongoCode

remove() public method

Change the query type to remove.
public remove ( )

rename() public method

Rename the current field.
See also: Expr::rename()
See also: http://docs.mongodb.org/manual/reference/operator/rename/
public rename ( string $name )
$name string

returnNew() public method

Set the "new" option for a findAndUpdate command.
public returnNew ( boolean $bool = true )
$bool boolean

select() public method

Set one or more fields to be included in the query projection.
public select ( $fieldName = null )

selectElemMatch() public method

Select only matching embedded documents in an array field for the query projection.
See also: http://docs.mongodb.org/manual/reference/projection/elemMatch/
public selectElemMatch ( string $fieldName, array | Expr $expression )
$fieldName string
$expression array | Expr

selectMeta() public method

Select a metadata field for the query projection.
See also: http://docs.mongodb.org/master/reference/operator/projection/meta/
public selectMeta ( string $fieldName, string $metaDataKeyword )
$fieldName string
$metaDataKeyword string

selectSlice() public method

The $countOrSkip parameter has two very different meanings, depending on whether or not $limit is provided. See the MongoDB documentation for more information.
See also: http://docs.mongodb.org/manual/reference/projection/slice/
public selectSlice ( string $fieldName, integer $countOrSkip, integer $limit = null )
$fieldName string
$countOrSkip integer Count parameter, or skip if limit is specified
$limit integer Limit parameter used in conjunction with skip

set() public method

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.
See also: Expr::set()
See also: http://docs.mongodb.org/manual/reference/operator/set/
public set ( mixed $value, boolean $atomic = true )
$value mixed
$atomic boolean

setNewObj() public method

Set the expression's "new object".
See also: Expr::setNewObj()
public setNewObj ( array $newObj )
$newObj array

setOnInsert() public method

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.
See also: Expr::setOnInsert()
See also: https://docs.mongodb.org/manual/reference/operator/update/setOnInsert/
public setOnInsert ( mixed $value )
$value mixed

setQueryArray() public method

Set the expression's query criteria.
See also: Expr::setQuery()
public setQueryArray ( array $query )
$query array

setReadPreference() public method

This is only relevant for read-only queries and commands.
See also: http://docs.mongodb.org/manual/core/read-preference/
public setReadPreference ( $readPreference, array $tags = null )
$tags array

size() public method

Specify $size criteria for the current field.
See also: Expr::size()
See also: http://docs.mongodb.org/manual/reference/operator/size/
public size ( integer $size )
$size integer

skip() public method

This is only relevant for find queries, or mapReduce queries that store results in an output collecton and return a cursor.
See also: Query::prepareCursor()
public skip ( integer $skip )
$skip integer

slaveOkay() public method

If the driver supports read preferences and slaveOkay is true, a "secondaryPreferred" read preference will be used. Otherwise, a "primary" read preference will be used.
See also: Doctrine\MongoDB\Cursor::setMongoCursorSlaveOkay()
public slaveOkay ( boolean $bool = true )
$bool boolean

snapshot() public method

Set the snapshot cursor flag.
public snapshot ( boolean $bool = true )
$bool boolean

sort() public method

If sorting by multiple fields, the first argument should be an array of field name (key) and order (value) pairs.
public sort ( array | string $fieldName, integer | string $order = 1 )
$fieldName array | string Field name or array of field/order pairs
$order integer | string Field order (if one field is specified)

sortMeta() public method

Sort order is not configurable for metadata fields. Sorting by a metadata field requires the same field and $meta expression to exist in the projection document. This method will call {@link Builder::selectMeta()} if the field is not already set in the projection.
See also: http://docs.mongodb.org/master/reference/operator/projection/meta/#sort
public sortMeta ( string $fieldName, string $metaDataKeyword )
$fieldName string Field name of the projected metadata
$metaDataKeyword string

spherical() public method

Set the "spherical" option for a geoNear command query.
public spherical ( boolean $spherical = true )
$spherical boolean

text() public method

The $language option may be set with {@link Builder::language()}.
See also: Expr::text()
See also: http://docs.mongodb.org/master/reference/operator/query/text/
public text ( string $search )
$search string

type() public method

Specify $type criteria for the current field.
See also: Expr::type()
See also: http://docs.mongodb.org/manual/reference/operator/type/
public type ( integer $type )
$type integer

unsetField() public method

The field will be removed from the document (not set to null).
See also: Expr::unsetField()
See also: http://docs.mongodb.org/manual/reference/operator/unset/
public unsetField ( )

update() public method

Change the query type to update.
Deprecation: Deprecated in version 1.4 - use updateOne or updateMany instead
public update ( )

updateMany() public method

Change the query type to update multiple documents
public updateMany ( )

updateOne() public method

Change the query type to update a single document
public updateOne ( )

upsert() public method

Set the "upsert" option for an update or findAndUpdate query.
public upsert ( boolean $bool = true )
$bool boolean

where() public method

Specify a JavaScript expression to use for matching documents.
See also: Expr::where()
See also: http://docs.mongodb.org/manual/reference/operator/where/
public where ( string | MongoCode $javascript )
$javascript string | MongoCode

withinBox() public method

Add $within criteria with a $box shape to the query.
See also: Builder::geoWithinBox()
See also: Expr::withinBox()
See also: http://docs.mongodb.org/manual/reference/operator/box/
Deprecation: 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
public withinBox ( float $x1, float $y1, float $x2, float $y2 )
$x1 float
$y1 float
$x2 float
$y2 float

withinCenter() public method

Add $within criteria with a $center shape to the query.
See also: Builder::geoWithinCenter()
See also: Expr::withinCenter()
See also: http://docs.mongodb.org/manual/reference/operator/center/
Deprecation: 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
public withinCenter ( float $x, float $y, float $radius )
$x float
$y float
$radius float

withinCenterSphere() public method

Add $within criteria with a $centerSphere shape to the query.
See also: Builder::geoWithinCenterSphere()
See also: Expr::withinCenterSphere()
See also: http://docs.mongodb.org/manual/reference/operator/centerSphere/
Deprecation: 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
public withinCenterSphere ( float $x, float $y, float $radius )
$x float
$y float
$radius float

withinPolygon() public method

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.
See also: Builder::geoWithinPolygon()
See also: Expr::withinPolygon()
See also: http://docs.mongodb.org/manual/reference/operator/polygon/
Deprecation: 1.1 MongoDB 2.4 deprecated $within in favor of $geoWithin
public withinPolygon ( )

Property Details

$collection protected_oe property

The Collection instance.
protected Collection,Doctrine\MongoDB $collection
return Doctrine\MongoDB\Collection

$expr protected_oe property

This object includes the query criteria and the "new object" used for insert and update queries.
protected Expr,Doctrine\MongoDB\Query $expr
return Expr

$query protected_oe property

Array containing the query data.
protected array $query
return array