PHP Class Sokil\Mongo\Expression

Inheritance: implements Sokil\Mongo\ArrayableInterface
Afficher le fichier Open project: sokil/php-mongo Class Usage Examples

Protected Properties

Свойство Type Description
$_expression

Méthodes publiques

Méthode Description
convertToArray ( mixed $mixed ) : array Transform expression in different formats to canonical array form
expression ( ) : Expression Create new instance of expression
intersects ( string $field, GeoJson\Geometry\Geometry $geometry ) : Expression Selects documents whose geospatial data intersects with a specified GeoJSON object; i.e. where the intersection of the data and the specified object is non-empty. This includes cases where the data and the specified object share an edge. Uses spherical geometry.
merge ( Expression $expression )
nearPoint ( string $field, float $longitude, float $latitude, integer | array $distance ) : Expression Find document near points in flat surface
nearPointSpherical ( string $field, float $longitude, float $latitude, integer | array $distance ) : Expression Find document near points in spherical surface
toArray ( )
where ( $field, $value ) : Cursor | Expression Return a expression
whereAll ( string $field, array $values ) : Expression Find documents where the value of a field is an array that contains all the specified elements.
whereAnd ( array | Expression $expressions = null ) : Expression Select the documents that satisfy all the expressions in the array
whereAny ( string $field, array $values ) : Expression Find documents where the value of a field is an array that contains any of the specified elements.
whereArray ( $field )
whereArrayOfArrays ( $field )
whereArraySize ( string $field, integer $length ) : Expression Selects documents if the array field is a specified size.
whereBoolean ( $field )
whereDate ( $field )
whereDouble ( $field )
whereElemMatch ( string $field, Expression | callable | array $expression ) : Expression Matches documents in a collection that contain an array field with at least one element that matches all the specified query criteria.
whereElemNotMatch ( type $field, Expression | callable | array $expression ) : Expression Matches documents in a collection that contain an array field with elements that do not matches all the specified query criteria.
whereEmpty ( $field )
whereExists ( $field )
whereGreater ( $field, $value )
whereGreaterOrEqual ( $field, $value )
whereHasType ( $field, $type )
whereIn ( string $field, array $values ) : Expression Selects the documents where the value of a field equals any value in the specified array.
whereJsCondition ( $condition )
whereLess ( $field, $value )
whereLessOrEqual ( $field, $value )
whereLike ( $field, $regex, $caseInsensitive = true )
whereMod ( string $field, integer $divisor, integer $remainder ) Select documents where the value of a field divided by a divisor has the specified remainder (i.e. perform a modulo operation to select documents)
whereNoneOf ( string $field, array $values ) : Expression Find documents where the value of a field is an array that contains none of the specified elements.
whereNor ( array | Expression $expressions = null ) : Expression Selects the documents that fail all the query expressions in the array
whereNot ( Expression $expression )
whereNotEmpty ( $field )
whereNotEqual ( $field, $value )
whereNotExists ( $field )
whereNotIn ( $field, array $values )
whereNull ( $field )
whereObject ( $field )
whereObjectId ( $field )
whereOr ( array | Expression $expressions = null ) : Expression Selects the documents that satisfy at least one of the expressions
whereString ( $field )
whereText ( $search, $language = null, boolean | false $caseSensitive = null, boolean | false $diacriticSensitive = null ) Perform fulltext search
within ( string $field, GeoJson\Geometry\Geometry $geometry ) : Expression Selects documents with geospatial data that exists entirely within a specified shape.
withinBox ( string $field, array $bottomLeftCoordinate, array $upperRightCoordinate ) : Expression Return documents that are within the bounds of the rectangle, according to their point-based location data.
withinCircle ( string $field, float $longitude, float $latitude, float $radius ) : Expression Select documents with geospatial data within circle defined by center point and radius in flat surface
withinCircleSpherical ( string $field, float $longitude, float $latitude, float $radiusInRadians ) : Expression Select documents with geospatial data within circle defined by center point and radius in spherical surface
withinPolygon ( string $field, array $points ) : Expression Return documents that are within the polygon, according to their point-based location data.

Method Details

convertToArray() public static méthode

Transform expression in different formats to canonical array form
public static convertToArray ( mixed $mixed ) : array
$mixed mixed
Résultat array

expression() public méthode

Create new instance of expression
public expression ( ) : Expression
Résultat Expression

intersects() public méthode

Selects documents whose geospatial data intersects with a specified GeoJSON object; i.e. where the intersection of the data and the specified object is non-empty. This includes cases where the data and the specified object share an edge. Uses spherical geometry.
public intersects ( string $field, GeoJson\Geometry\Geometry $geometry ) : Expression
$field string
$geometry GeoJson\Geometry\Geometry
Résultat Expression

merge() public méthode

public merge ( Expression $expression )
$expression Expression

nearPoint() public méthode

Find document near points in flat surface
public nearPoint ( string $field, float $longitude, float $latitude, integer | array $distance ) : Expression
$field string
$longitude float
$latitude float
$distance integer | array distance from point in meters. Array distance allowed only in MongoDB 2.6
Résultat Expression

nearPointSpherical() public méthode

Find document near points in spherical surface
public nearPointSpherical ( string $field, float $longitude, float $latitude, integer | array $distance ) : Expression
$field string
$longitude float
$latitude float
$distance integer | array distance from point in meters. Array distance allowed only in MongoDB 2.6
Résultat Expression

toArray() public méthode

public toArray ( )

where() public méthode

Return a expression
public where ( $field, $value ) : Cursor | Expression
Résultat Cursor | Expression

whereAll() public méthode

This is equivalent of logical AND.
public whereAll ( string $field, array $values ) : Expression
$field string point-delimited field name
$values array
Résultat Expression

whereAnd() public méthode

Select the documents that satisfy all the expressions in the array
public whereAnd ( array | Expression $expressions = null ) : Expression
$expressions array | Expression Array of Expression instances or comma delimited expression list
Résultat Expression

whereAny() public méthode

This is equivalent of logical AND.
public whereAny ( string $field, array $values ) : Expression
$field string point-delimited field name
$values array
Résultat Expression

whereArray() public méthode

public whereArray ( $field )

whereArrayOfArrays() public méthode

public whereArrayOfArrays ( $field )

whereArraySize() public méthode

Selects documents if the array field is a specified size.
public whereArraySize ( string $field, integer $length ) : Expression
$field string
$length integer
Résultat Expression

whereBoolean() public méthode

public whereBoolean ( $field )

whereDate() public méthode

public whereDate ( $field )

whereDouble() public méthode

public whereDouble ( $field )

whereElemMatch() public méthode

Matches documents in a collection that contain an array field with at least one element that matches all the specified query criteria.
public whereElemMatch ( string $field, Expression | callable | array $expression ) : Expression
$field string point-delimited field name
$expression Expression | callable | array
Résultat Expression

whereElemNotMatch() public méthode

Matches documents in a collection that contain an array field with elements that do not matches all the specified query criteria.
public whereElemNotMatch ( type $field, Expression | callable | array $expression ) : Expression
$field type
$expression Expression | callable | array
Résultat Expression

whereEmpty() public méthode

public whereEmpty ( $field )

whereExists() public méthode

public whereExists ( $field )

whereGreater() public méthode

public whereGreater ( $field, $value )

whereGreaterOrEqual() public méthode

public whereGreaterOrEqual ( $field, $value )

whereHasType() public méthode

public whereHasType ( $field, $type )

whereIn() public méthode

Selects the documents where the value of a field equals any value in the specified array.
public whereIn ( string $field, array $values ) : Expression
$field string
$values array
Résultat Expression

whereJsCondition() public méthode

public whereJsCondition ( $condition )

whereLess() public méthode

public whereLess ( $field, $value )

whereLessOrEqual() public méthode

public whereLessOrEqual ( $field, $value )

whereLike() public méthode

public whereLike ( $field, $regex, $caseInsensitive = true )

whereMod() public méthode

Select documents where the value of a field divided by a divisor has the specified remainder (i.e. perform a modulo operation to select documents)
public whereMod ( string $field, integer $divisor, integer $remainder )
$field string
$divisor integer
$remainder integer

whereNoneOf() public méthode

This is equivalent of logical AND.
public whereNoneOf ( string $field, array $values ) : Expression
$field string point-delimited field name
$values array
Résultat Expression

whereNor() public méthode

Selects the documents that fail all the query expressions in the array
public whereNor ( array | Expression $expressions = null ) : Expression
$expressions array | Expression Array of Expression instances or comma delimited expression list
Résultat Expression

whereNot() public méthode

public whereNot ( Expression $expression )
$expression Expression

whereNotEmpty() public méthode

public whereNotEmpty ( $field )

whereNotEqual() public méthode

public whereNotEqual ( $field, $value )

whereNotExists() public méthode

public whereNotExists ( $field )

whereNotIn() public méthode

public whereNotIn ( $field, array $values )
$values array

whereNull() public méthode

public whereNull ( $field )

whereObject() public méthode

public whereObject ( $field )

whereObjectId() public méthode

public whereObjectId ( $field )

whereOr() public méthode

Selects the documents that satisfy at least one of the expressions
public whereOr ( array | Expression $expressions = null ) : Expression
$expressions array | Expression Array of Expression instances or comma delimited expression list
Résultat Expression

whereString() public méthode

public whereString ( $field )

whereText() public méthode

Perform fulltext search
public whereText ( $search, $language = null, boolean | false $caseSensitive = null, boolean | false $diacriticSensitive = null )
$search A string of terms that MongoDB parses and uses to query the text index. MongoDB performs a logical OR search of the terms unless specified as a phrase.
$language Optional. The language that determines the list of stop words for the search and the rules for the stemmer and tokenizer. If not specified, the search uses the default language of the index. If you specify a language value of "none", then the text search uses simple tokenization with no list of stop words and no stemming.
$caseSensitive boolean | false Allowed from v.3.2 A boolean flag to enable or disable case sensitive search. Defaults to false; i.e. the search defers to the case insensitivity of the text index.
$diacriticSensitive boolean | false Allowed from v.3.2 A boolean flag to enable or disable diacritic sensitive search against version 3 text indexes. Defaults to false; i.e. the search defers to the diacritic insensitivity of the text index. Text searches against earlier versions of the text index are inherently diacritic sensitive and cannot be diacritic insensitive. As such, the $diacriticSensitive option has no effect with earlier versions of the text index.

within() public méthode

Selects documents with geospatial data that exists entirely within a specified shape.
public within ( string $field, GeoJson\Geometry\Geometry $geometry ) : Expression
$field string
$geometry GeoJson\Geometry\Geometry
Résultat Expression

withinBox() public méthode

Based on grid coordinates and does not query for GeoJSON shapes. Use planar geometry, so 2d index may be used but not required
public withinBox ( string $field, array $bottomLeftCoordinate, array $upperRightCoordinate ) : Expression
$field string
$bottomLeftCoordinate array Bottom left coordinate of box
$upperRightCoordinate array Upper right coordinate of box
Résultat Expression

withinCircle() public méthode

Select documents with geospatial data within circle defined by center point and radius in flat surface
public withinCircle ( string $field, float $longitude, float $latitude, float $radius ) : Expression
$field string
$longitude float
$latitude float
$radius float
Résultat Expression

withinCircleSpherical() public méthode

To calculate distance in radians
See also: http://docs.mongodb.org/manual/tutorial/calculate-distances-using-spherical-geometry-with-2d-geospatial-indexes/
public withinCircleSpherical ( string $field, float $longitude, float $latitude, float $radiusInRadians ) : Expression
$field string
$longitude float
$latitude float
$radiusInRadians float in radians.
Résultat Expression

withinPolygon() public méthode

Based on grid coordinates and does not query for GeoJSON shapes. Use planar geometry, so 2d index may be used but not required
public withinPolygon ( string $field, array $points ) : Expression
$field string
$points array array of coordinates
Résultat Expression

Property Details

$_expression protected_oe property

protected $_expression