PHP Class Sokil\Mongo\Operator

Inheritance: implements Sokil\Mongo\ArrayableInterface
Show file Open project: sokil/php-mongo Class Usage Examples

Public Methods

Method Description
addToSet ( $field, $value )
addToSetEach ( $field, array $values )
bitwiceAnd ( $field, $value )
bitwiceOr ( $field, $value )
bitwiceXor ( $field, $value )
convertToArray ( mixed $mixed ) : array Transform operator in different formats to canonical array form
get ( $operation, $fieldName = null )
getAll ( ) : array
increment ( $fieldName, $value = 1 )
isDefined ( )
isReloadRequired ( )
pull ( integer | string | Expression | callable $expression, mixed | Expression | callable $value = null ) : Operator The $pull operator removes from an existing array all instances of a value or values that match a specified query.
push ( $fieldName, $value )
pushEach ( $fieldName, array $values )
pushEachPosition ( string $field, integer $position ) : Operator The $position modifier specifies the location in the array at which the $push operator insert elements. Without the $position modifier, the $push operator inserts elements to the end of the array. See $push modifiers for more information.
pushEachSlice ( string $field, integer $slice ) : Operator The $slice modifier limits the number of array elements during a $push operation. To project, or return, a specified number of array elements from a read operation, see the $slice projection operator instead.
pushEachSort ( string $field, array $sort ) : Operator The $sort modifier orders the elements of an array during a $push operation.
reset ( )
set ( $fieldName, $value )
toArray ( )
unsetField ( string $fieldName ) : Operator The $unset operator deletes a particular field

Method Details

addToSet() public method

public addToSet ( $field, $value )

addToSetEach() public method

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

bitwiceAnd() public method

public bitwiceAnd ( $field, $value )

bitwiceOr() public method

public bitwiceOr ( $field, $value )

bitwiceXor() public method

public bitwiceXor ( $field, $value )

convertToArray() public static method

Transform operator in different formats to canonical array form
public static convertToArray ( mixed $mixed ) : array
$mixed mixed
return array

get() public method

public get ( $operation, $fieldName = null )

getAll() public method

Deprecation: since v.1.13 use Operator::toArray()
public getAll ( ) : array
return array

increment() public method

public increment ( $fieldName, $value = 1 )

isDefined() public method

public isDefined ( )

isReloadRequired() public method

public isReloadRequired ( )

pull() public method

The $pull operator removes from an existing array all instances of a value or values that match a specified query.
public pull ( integer | string | Expression | callable $expression, mixed | Expression | callable $value = null ) : Operator
$expression integer | string | Expression | callable
$value mixed | Expression | callable
return Operator

push() public method

public push ( $fieldName, $value )

pushEach() public method

public pushEach ( $fieldName, array $values )
$values array

pushEachPosition() public method

The $position modifier specifies the location in the array at which the $push operator insert elements. Without the $position modifier, the $push operator inserts elements to the end of the array. See $push modifiers for more information.
public pushEachPosition ( string $field, integer $position ) : Operator
$field string
$position integer non-negative number that corresponds to the position in the array, based on a zero-based index
return Operator

pushEachSlice() public method

The $slice modifier limits the number of array elements during a $push operation. To project, or return, a specified number of array elements from a read operation, see the $slice projection operator instead.
public pushEachSlice ( string $field, integer $slice ) : Operator
$field string
$slice integer
return Operator

pushEachSort() public method

The $sort modifier orders the elements of an array during a $push operation.
public pushEachSort ( string $field, array $sort ) : Operator
$field string
$sort array
return Operator

reset() public method

public reset ( )

set() public method

public set ( $fieldName, $value )

toArray() public method

public toArray ( )

unsetField() public method

The $unset operator deletes a particular field
public unsetField ( string $fieldName ) : Operator
$fieldName string
return Operator