PHP Class LMongo\Query\Builder

Afficher le fichier Open project: navruzm/lmongo Class Usage Examples

Méthodes publiques

Свойство Type Description
$collection string The database collection
$columns array The columns that should be returned.
$limit integer The maximum number of documents to return.
$offset integer The number of documents to skip.
$orders array The orderings for the query.
$wheres array The where constraints for the query.

Protected Properties

Свойство Type Description
$cacheKey string The key that should be used when caching the query.
$cacheMinutes integer The number of minutes to cache the query.
$connection LMongo\Connection The database connection instance.
$first boolean Indicates if the first where set or not.

Méthodes publiques

Méthode Description
__construct ( Connection $connection ) : void Create a new query builder instance.
addToSet ( string $column, mixed $value = null ) : integer Append one unique value to the array key.
aggregate ( string $function, string $column, array $query = [] ) : mixed Execute an aggregate function on the database.
andWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder Add an "$and logical operation" clause to the query.
andWhereAll ( string $column, array $value ) : LMongo\Query\Builder Add an "$all comparison operation" clause to logical $and operation.
andWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder Add a where between statement to logical $and operation.
andWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder Add an "$exists element operation" clause to logical $and operation.
andWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder Add an "$geoIntersects geospatial operation" clause to logical $and operation.
andWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder Add an "$geoWithin geospatial operation" clause to logical $and operation.
andWhereGt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gt comparison operation" clause to logical $and operation.
andWhereGte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gte comparison operation" clause to logical $and operation.
andWhereIn ( string $column, array $value ) : LMongo\Query\Builder Add an "$in comparison operation" clause to logical $and operation.
andWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder Add a like statement with $regex operation to logical $and operation.
andWhereLt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lt comparison operation" clause to logical $and operation.
andWhereLte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lte comparison operation" clause to logical $and operation.
andWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder Add an "$mod element operation" clause to logical $and operation.
andWhereNe ( string $column, string $value ) : LMongo\Query\Builder Add an "$ne comparison operation" clause to logical $and operation.
andWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$near geospatial operation" clause to logical $and operation.
andWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$nearSphere geospatial operation" clause to logical $and operation.
andWhereNin ( string $column, array $value ) : LMongo\Query\Builder Add an "$nin comparison operation" clause to logical $and operation.
andWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder Add an "$regex JavaScript operation" clause to logical $and operation.
andWhereSize ( string $column, integer $value ) : LMongo\Query\Builder Add an "$size array operation" clause to logical $and operation.
andWhereType ( string $column, integer $type ) : LMongo\Query\Builder Add an "$type element operation" clause to logical $and operation.
avg ( string $column, array $query = [] ) : mixed Retrieve the avg of the values of a given column.
batchInsert ( array $data ) : mixed Insert a new documents into the database.
collection ( string $collection ) : LMongo\Query\Builder Set the collection which the query is targeting.
compileWheres ( Builder $query ) : array Compile the query
count ( ) : integer Execute the query to return count.
decrement ( string $column, integer $amount = 1, array $extra = [] ) : integer Decrement a column's value by a given amount.
delete ( ) : integer Delete a document from the database.
distinct ( string $column, array $query = [] ) : array Execute the query to only return distinct results.
exists ( ) : boolean Determine if any document exist for the current query.
find ( integer $id, array $columns = [] ) : mixed Execute a query for a single record by _id.
first ( array $columns = [] ) : mixed Execute the query and get the first result.
forPage ( integer $page, integer $perPage = 15 ) : LMongo\Query\Builder Set the limit and offset for a given page.
generateCacheKey ( ) : string Generate the unique cache key for the query.
get ( array $columns = [] ) : LMongo\Query\Cursor Execute the query.
getAndResetWheres ( ) : array Get a copy of the where clauses and reset.
getCacheKey ( ) : string Get a unique cache key for the complete query.
getCached ( array $columns = [] ) : array Execute cached query.
getConnection ( ) : Connection Get the database connection instance.
getFresh ( array $columns = [], $cursor = false ) : array Execute fresh query.
group ( array $initial, mixed $reduce, mixed $columns = [], array $options = [] ) : LMongo\Query\Cursor Execute a group command on the database.
implode ( string $column, string $glue = null ) : string Concatenate values of a given column as a string.
increment ( string $column, integer $amount = 1, array $extra = [] ) : integer Increment a column's value by a given amount.
insert ( array $data ) : mixed Insert a new document into the database.
max ( string $column, array $query = [] ) : mixed Retrieve the maximum value of a given column.
min ( string $column, array $query = [] ) : mixed Retrieve the minimum value of a given column.
newQuery ( ) : Builder new Query Builder instance
norWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder Add an "$nor logical operation" clause to the query.
norWhereAll ( string $column, array $value ) : LMongo\Query\Builder Add an "$all comparison operation" clause to logical $nor operation.
norWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder Add a where between statement to logical $nor operation.
norWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder Add an "$exists element operation" clause to logical $nor operation.
norWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder Add an "$geoIntersects geospatial operation" clause to logical $nor operation.
norWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder Add an "$geoWithin geospatial operation" clause to logical $nor operation.
norWhereGt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gt comparison operation" clause to logical $nor operation.
norWhereGte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gte comparison operation" clause to logical $nor operation.
norWhereIn ( string $column, array $value ) : LMongo\Query\Builder Add an "$in comparison operation" clause to logical $nor operation.
norWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder Add a like statement with $regex operation to logical $nor operation.
norWhereLt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lt comparison operation" clause to logical $nor operation.
norWhereLte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lte comparison operation" clause to logical $nor operation.
norWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder Add an "$mod element operation" clause to logical $nor operation.
norWhereNe ( string $column, string $value ) : LMongo\Query\Builder Add an "$ne comparison operation" clause to logical $nor operation.
norWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$near geospatial operation" clause to logical $nor operation.
norWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$nearSphere geospatial operation" clause to logical $nor operation.
norWhereNin ( string $column, array $value ) : LMongo\Query\Builder Add an "$nin comparison operation" clause to logical $nor operation.
norWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder Add an "$regex JavaScript operation" clause to logical $nor operation.
norWhereSize ( string $column, integer $value ) : LMongo\Query\Builder Add an "$size array operation" clause to logical $nor operation.
norWhereType ( string $column, integer $type ) : LMongo\Query\Builder Add an "$type element operation" clause to logical $nor operation.
orWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder Add an "$or logical operation" clause to the query.
orWhereAll ( string $column, array $value ) : LMongo\Query\Builder Add an "$all comparison operation" clause to logical $or operation.
orWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder Add a where between statement to logical $or operation.
orWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder Add an "$exists element operation" clause to logical $or operation.
orWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder Add an "$geoIntersects geospatial operation" clause to logical $or operation.
orWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder Add an "$geoWithin geospatial operation" clause to logical $or operation.
orWhereGt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gt comparison operation" clause to logical $or operation.
orWhereGte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gte comparison operation" clause to logical $or operation.
orWhereIn ( string $column, array $value ) : LMongo\Query\Builder Add an "$in comparison operation" clause to logical $or operation.
orWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder Add a like statement with $regex operation to logical $or operation.
orWhereLt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lt comparison operation" clause to logical $or operation.
orWhereLte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lte comparison operation" clause to logical $or operation.
orWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder Add an "$mod element operation" clause to logical $or operation.
orWhereNe ( string $column, string $value ) : LMongo\Query\Builder Add an "$ne comparison operation" clause to logical $or operation.
orWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$near geospatial operation" clause to logical $or operation.
orWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder Add an "$nearSphere geospatial operation" clause to logical $or operation.
orWhereNin ( string $column, array $value ) : LMongo\Query\Builder Add an "$nin comparison operation" clause to logical $or operation.
orWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder Add an "$regex JavaScript operation" clause to logical $or operation.
orWhereSize ( string $column, integer $value ) : LMongo\Query\Builder Add an "$size array operation" clause to logical $or operation.
orWhereType ( string $column, integer $type ) : LMongo\Query\Builder Add an "$type element operation" clause to logical $or operation.
orderBy ( string $column, string $direction = 'asc' ) : LMongo\Query\Builder Add an "order by" clause to the query.
paginate ( integer $perPage = 15, array $columns = [] ) : Illuminate\Pagination\Paginator Get a paginator.
pluck ( string $column ) : mixed Pluck a single column from the database.
pop ( string $column, integer $type = 1 ) : integer Remove the last element from the array key.
pull ( string $column, mixed $value = null ) : integer Remove one value from the array key.
pullAll ( string $column, mixed $value = null ) : integer Remove several value from the array key.
push ( string $column, mixed $value = null ) : integer Append one value to the array key.
pushAll ( string $column, array $values ) : integer Append several value to the array key.
remember ( integer $minutes, string $key = null ) : Builder Indicate that the query results should be cached.
remove ( ) : integer Alias of delete.
renameField ( mixed $old, mixed $new = null ) : integer Renames a field.
resetQuery ( ) : void Reset the query
save ( array $data ) : mixed Save the document. Insert into the database if its not exists.
setConnection ( Connection $connection ) : Connection Set the database connection instance.
setField ( mixed $column, mixed $value = null ) : integer Set the values for the keys.
skip ( integer $value ) : LMongo\Query\Builder Set the "offset" value of the query.
sum ( string $column, array $query = [] ) : mixed Retrieve the sum of the values of a given column.
take ( integer $value ) : LMongo\Query\Builder Set the "limit" value of the query.
truncate ( ) : void Drop the collection.
unsetField ( mixed $column ) : integer Unset or remove the given keys.
update ( array $data ) : integer Update a document in the database.
where ( string $column, mixed $value = null, string $logic = 'first' ) : LMongo\Query\Builder Add a basic where clause to the query.
whereAll ( string $column, array $value ) : LMongo\Query\Builder Add an "$all comparison operation" clause to logical operation.
whereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder Add a where between statement to logical operation.
whereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder Add an "$exists element operation" clause to logical operation.
whereGeoIntersects ( string $column, string $geometry, array $coords, string $boolean = 'first' ) : LMongo\Query\Builder Add an "$geoIntersects geospatial operation" clause to logical operation.
whereGeoWithin ( string $column, string $shape, array $coords, string $boolean = 'first' ) : LMongo\Query\Builder Add an "$geoWithin geospatial operation" clause to logical operation.
whereGt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gt comparison operation" clause to logical operation.
whereGte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$gte comparison operation" clause to logical operation.
whereIn ( string $column, array $value ) : LMongo\Query\Builder Add an "$in comparison operation" clause to logical operation.
whereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder Add a like statement with $regex operation to logical operation.
whereLt ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lt comparison operation" clause to logical operation.
whereLte ( string $column, integer $value ) : LMongo\Query\Builder Add an "$lte comparison operation" clause to logical operation.
whereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder Add an "$mod element operation" clause to logical operation.
whereNe ( string $column, string $value ) : LMongo\Query\Builder Add an "$ne comparison operation" clause to logical operation.
whereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null, string $boolean = 'first' ) : LMongo\Query\Builder Add an "$near geospatial operation" clause to logical operation.
whereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null, string $boolean = 'first' ) : LMongo\Query\Builder Add an "$nearSphere geospatial operation" clause to logical operation.
whereNested ( Closure $callback, string $logic = '$and' ) : LMongo\Query\Builder Add a nested where statement to the query.
whereNin ( string $column, array $value ) : LMongo\Query\Builder Add an "$nin comparison operation" clause to logical operation.
whereRegex ( string $column, mixed $value ) : LMongo\Query\Builder Add an "$regex JavaScript operation" clause to logical operation.
whereSize ( string $column, integer $value ) : LMongo\Query\Builder Add an "$size array operation" clause to logical operation.
whereType ( string $column, integer $type ) : LMongo\Query\Builder Add an "$type element operation" clause to logical operation.

Méthodes protégées

Méthode Description
compileWhereBasic ( Builder $query, array $where ) : array Compile a basic operation clause.
compileWhereNested ( Builder $query, array $where ) : array Compile a nested operation clause.
getCacheCallback ( array $columns ) : Closure Get the Closure callback used when caching queries.
getCacheInfo ( ) : array Get the cache key and cache minutes as an array.
performUpdate ( array $query ) : integer Perform update.

Private Methods

Méthode Description
prepareColumns ( ) : array Retrieve the select statement.
prepareOrderBy ( mixed $direction ) : integer Transform sql style order statement to mongodb style.

Method Details

__construct() public méthode

Create a new query builder instance.
public __construct ( Connection $connection ) : void
$connection LMongo\Connection
Résultat void

addToSet() public méthode

Append one unique value to the array key.
public addToSet ( string $column, mixed $value = null ) : integer
$column string
$value mixed
Résultat integer

aggregate() public méthode

Execute an aggregate function on the database.
public aggregate ( string $function, string $column, array $query = [] ) : mixed
$function string
$column string
$query array
Résultat mixed

andWhere() public méthode

Add an "$and logical operation" clause to the query.
public andWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

andWhereAll() public méthode

Add an "$all comparison operation" clause to logical $and operation.
public andWhereAll ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

andWhereBetween() public méthode

Add a where between statement to logical $and operation.
public andWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder
$column string
$min integer
$max integer
Résultat LMongo\Query\Builder

andWhereExists() public méthode

Add an "$exists element operation" clause to logical $and operation.
public andWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder
$column string
$exists boolean
Résultat LMongo\Query\Builder

andWhereGeoIntersects() public méthode

Add an "$geoIntersects geospatial operation" clause to logical $and operation.
public andWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder
$column string
$geometry string
$coords array
Résultat LMongo\Query\Builder

andWhereGeoWithin() public méthode

Add an "$geoWithin geospatial operation" clause to logical $and operation.
public andWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder
$column string
$shape string
$coords array
Résultat LMongo\Query\Builder

andWhereGt() public méthode

Add an "$gt comparison operation" clause to logical $and operation.
public andWhereGt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

andWhereGte() public méthode

Add an "$gte comparison operation" clause to logical $and operation.
public andWhereGte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

andWhereIn() public méthode

Add an "$in comparison operation" clause to logical $and operation.
public andWhereIn ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

andWhereLike() public méthode

Add a like statement with $regex operation to logical $and operation.
public andWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder
$column string
$value mixed
$flags string
Résultat LMongo\Query\Builder

andWhereLt() public méthode

Add an "$lt comparison operation" clause to logical $and operation.
public andWhereLt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

andWhereLte() public méthode

Add an "$lte comparison operation" clause to logical $and operation.
public andWhereLte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

andWhereMod() public méthode

Add an "$mod element operation" clause to logical $and operation.
public andWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder
$column string
$divisor integer
$remainder integer
Résultat LMongo\Query\Builder

andWhereNe() public méthode

Add an "$ne comparison operation" clause to logical $and operation.
public andWhereNe ( string $column, string $value ) : LMongo\Query\Builder
$column string
$value string
Résultat LMongo\Query\Builder

andWhereNear() public méthode

Add an "$near geospatial operation" clause to logical $and operation.
public andWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

andWhereNearSphere() public méthode

Add an "$nearSphere geospatial operation" clause to logical $and operation.
public andWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

andWhereNin() public méthode

Add an "$nin comparison operation" clause to logical $and operation.
public andWhereNin ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

andWhereRegex() public méthode

Add an "$regex JavaScript operation" clause to logical $and operation.
public andWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

andWhereSize() public méthode

Add an "$size array operation" clause to logical $and operation.
public andWhereSize ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

andWhereType() public méthode

Add an "$type element operation" clause to logical $and operation.
public andWhereType ( string $column, integer $type ) : LMongo\Query\Builder
$column string
$type integer
Résultat LMongo\Query\Builder

avg() public méthode

Retrieve the avg of the values of a given column.
public avg ( string $column, array $query = [] ) : mixed
$column string
$query array
Résultat mixed

batchInsert() public méthode

Insert a new documents into the database.
public batchInsert ( array $data ) : mixed
$data array
Résultat mixed

collection() public méthode

Set the collection which the query is targeting.
public collection ( string $collection ) : LMongo\Query\Builder
$collection string
Résultat LMongo\Query\Builder

compileWhereBasic() protected méthode

Compile a basic operation clause.
protected compileWhereBasic ( Builder $query, array $where ) : array
$query Builder
$where array
Résultat array

compileWhereNested() protected méthode

Compile a nested operation clause.
protected compileWhereNested ( Builder $query, array $where ) : array
$query Builder
$where array
Résultat array

compileWheres() public méthode

Compile the query
public compileWheres ( Builder $query ) : array
$query Builder
Résultat array

count() public méthode

Execute the query to return count.
public count ( ) : integer
Résultat integer

decrement() public méthode

Decrement a column's value by a given amount.
public decrement ( string $column, integer $amount = 1, array $extra = [] ) : integer
$column string
$amount integer
$extra array
Résultat integer

delete() public méthode

Delete a document from the database.
public delete ( ) : integer
Résultat integer

distinct() public méthode

Execute the query to only return distinct results.
public distinct ( string $column, array $query = [] ) : array
$column string
$query array
Résultat array

exists() public méthode

Determine if any document exist for the current query.
public exists ( ) : boolean
Résultat boolean

find() public méthode

Execute a query for a single record by _id.
public find ( integer $id, array $columns = [] ) : mixed
$id integer
$columns array
Résultat mixed

first() public méthode

Execute the query and get the first result.
public first ( array $columns = [] ) : mixed
$columns array
Résultat mixed

forPage() public méthode

Set the limit and offset for a given page.
public forPage ( integer $page, integer $perPage = 15 ) : LMongo\Query\Builder
$page integer
$perPage integer
Résultat LMongo\Query\Builder

generateCacheKey() public méthode

Generate the unique cache key for the query.
public generateCacheKey ( ) : string
Résultat string

get() public méthode

Execute the query.
public get ( array $columns = [] ) : LMongo\Query\Cursor
$columns array
Résultat LMongo\Query\Cursor

getAndResetWheres() public méthode

Get a copy of the where clauses and reset.
public getAndResetWheres ( ) : array
Résultat array

getCacheCallback() protected méthode

Get the Closure callback used when caching queries.
protected getCacheCallback ( array $columns ) : Closure
$columns array
Résultat Closure

getCacheInfo() protected méthode

Get the cache key and cache minutes as an array.
protected getCacheInfo ( ) : array
Résultat array

getCacheKey() public méthode

Get a unique cache key for the complete query.
public getCacheKey ( ) : string
Résultat string

getCached() public méthode

Execute cached query.
public getCached ( array $columns = [] ) : array
$columns array
Résultat array

getConnection() public méthode

Get the database connection instance.
public getConnection ( ) : Connection
Résultat LMongo\Connection

getFresh() public méthode

Execute fresh query.
public getFresh ( array $columns = [], $cursor = false ) : array
$columns array
Résultat array

group() public méthode

Execute a group command on the database.
public group ( array $initial, mixed $reduce, mixed $columns = [], array $options = [] ) : LMongo\Query\Cursor
$initial array
$reduce mixed
$columns mixed
$options array
Résultat LMongo\Query\Cursor

implode() public méthode

Concatenate values of a given column as a string.
public implode ( string $column, string $glue = null ) : string
$column string
$glue string
Résultat string

increment() public méthode

Increment a column's value by a given amount.
public increment ( string $column, integer $amount = 1, array $extra = [] ) : integer
$column string
$amount integer
$extra array
Résultat integer

insert() public méthode

Insert a new document into the database.
public insert ( array $data ) : mixed
$data array
Résultat mixed

max() public méthode

Retrieve the maximum value of a given column.
public max ( string $column, array $query = [] ) : mixed
$column string
$query array
Résultat mixed

min() public méthode

Retrieve the minimum value of a given column.
public min ( string $column, array $query = [] ) : mixed
$column string
$query array
Résultat mixed

newQuery() public méthode

new Query Builder instance
public newQuery ( ) : Builder
Résultat Builder

norWhere() public méthode

Add an "$nor logical operation" clause to the query.
public norWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

norWhereAll() public méthode

Add an "$all comparison operation" clause to logical $nor operation.
public norWhereAll ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

norWhereBetween() public méthode

Add a where between statement to logical $nor operation.
public norWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder
$column string
$min integer
$max integer
Résultat LMongo\Query\Builder

norWhereExists() public méthode

Add an "$exists element operation" clause to logical $nor operation.
public norWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder
$column string
$exists boolean
Résultat LMongo\Query\Builder

norWhereGeoIntersects() public méthode

Add an "$geoIntersects geospatial operation" clause to logical $nor operation.
public norWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder
$column string
$geometry string
$coords array
Résultat LMongo\Query\Builder

norWhereGeoWithin() public méthode

Add an "$geoWithin geospatial operation" clause to logical $nor operation.
public norWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder
$column string
$shape string
$coords array
Résultat LMongo\Query\Builder

norWhereGt() public méthode

Add an "$gt comparison operation" clause to logical $nor operation.
public norWhereGt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

norWhereGte() public méthode

Add an "$gte comparison operation" clause to logical $nor operation.
public norWhereGte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

norWhereIn() public méthode

Add an "$in comparison operation" clause to logical $nor operation.
public norWhereIn ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

norWhereLike() public méthode

Add a like statement with $regex operation to logical $nor operation.
public norWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder
$column string
$value mixed
$flags string
Résultat LMongo\Query\Builder

norWhereLt() public méthode

Add an "$lt comparison operation" clause to logical $nor operation.
public norWhereLt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

norWhereLte() public méthode

Add an "$lte comparison operation" clause to logical $nor operation.
public norWhereLte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

norWhereMod() public méthode

Add an "$mod element operation" clause to logical $nor operation.
public norWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder
$column string
$divisor integer
$remainder integer
Résultat LMongo\Query\Builder

norWhereNe() public méthode

Add an "$ne comparison operation" clause to logical $nor operation.
public norWhereNe ( string $column, string $value ) : LMongo\Query\Builder
$column string
$value string
Résultat LMongo\Query\Builder

norWhereNear() public méthode

Add an "$near geospatial operation" clause to logical $nor operation.
public norWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

norWhereNearSphere() public méthode

Add an "$nearSphere geospatial operation" clause to logical $nor operation.
public norWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

norWhereNin() public méthode

Add an "$nin comparison operation" clause to logical $nor operation.
public norWhereNin ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

norWhereRegex() public méthode

Add an "$regex JavaScript operation" clause to logical $nor operation.
public norWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

norWhereSize() public méthode

Add an "$size array operation" clause to logical $nor operation.
public norWhereSize ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

norWhereType() public méthode

Add an "$type element operation" clause to logical $nor operation.
public norWhereType ( string $column, integer $type ) : LMongo\Query\Builder
$column string
$type integer
Résultat LMongo\Query\Builder

orWhere() public méthode

Add an "$or logical operation" clause to the query.
public orWhere ( string $column, mixed $value = null ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

orWhereAll() public méthode

Add an "$all comparison operation" clause to logical $or operation.
public orWhereAll ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

orWhereBetween() public méthode

Add a where between statement to logical $or operation.
public orWhereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder
$column string
$min integer
$max integer
Résultat LMongo\Query\Builder

orWhereExists() public méthode

Add an "$exists element operation" clause to logical $or operation.
public orWhereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder
$column string
$exists boolean
Résultat LMongo\Query\Builder

orWhereGeoIntersects() public méthode

Add an "$geoIntersects geospatial operation" clause to logical $or operation.
public orWhereGeoIntersects ( string $column, string $geometry, array $coords ) : LMongo\Query\Builder
$column string
$geometry string
$coords array
Résultat LMongo\Query\Builder

orWhereGeoWithin() public méthode

Add an "$geoWithin geospatial operation" clause to logical $or operation.
public orWhereGeoWithin ( string $column, string $shape, array $coords ) : LMongo\Query\Builder
$column string
$shape string
$coords array
Résultat LMongo\Query\Builder

orWhereGt() public méthode

Add an "$gt comparison operation" clause to logical $or operation.
public orWhereGt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

orWhereGte() public méthode

Add an "$gte comparison operation" clause to logical $or operation.
public orWhereGte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

orWhereIn() public méthode

Add an "$in comparison operation" clause to logical $or operation.
public orWhereIn ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

orWhereLike() public méthode

Add a like statement with $regex operation to logical $or operation.
public orWhereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder
$column string
$value mixed
$flags string
Résultat LMongo\Query\Builder

orWhereLt() public méthode

Add an "$lt comparison operation" clause to logical $or operation.
public orWhereLt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

orWhereLte() public méthode

Add an "$lte comparison operation" clause to logical $or operation.
public orWhereLte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

orWhereMod() public méthode

Add an "$mod element operation" clause to logical $or operation.
public orWhereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder
$column string
$divisor integer
$remainder integer
Résultat LMongo\Query\Builder

orWhereNe() public méthode

Add an "$ne comparison operation" clause to logical $or operation.
public orWhereNe ( string $column, string $value ) : LMongo\Query\Builder
$column string
$value string
Résultat LMongo\Query\Builder

orWhereNear() public méthode

Add an "$near geospatial operation" clause to logical $or operation.
public orWhereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

orWhereNearSphere() public méthode

Add an "$nearSphere geospatial operation" clause to logical $or operation.
public orWhereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
Résultat LMongo\Query\Builder

orWhereNin() public méthode

Add an "$nin comparison operation" clause to logical $or operation.
public orWhereNin ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

orWhereRegex() public méthode

Add an "$regex JavaScript operation" clause to logical $or operation.
public orWhereRegex ( string $column, mixed $value ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

orWhereSize() public méthode

Add an "$size array operation" clause to logical $or operation.
public orWhereSize ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

orWhereType() public méthode

Add an "$type element operation" clause to logical $or operation.
public orWhereType ( string $column, integer $type ) : LMongo\Query\Builder
$column string
$type integer
Résultat LMongo\Query\Builder

orderBy() public méthode

Add an "order by" clause to the query.
public orderBy ( string $column, string $direction = 'asc' ) : LMongo\Query\Builder
$column string
$direction string
Résultat LMongo\Query\Builder

paginate() public méthode

Get a paginator.
public paginate ( integer $perPage = 15, array $columns = [] ) : Illuminate\Pagination\Paginator
$perPage integer
$columns array
Résultat Illuminate\Pagination\Paginator

performUpdate() protected méthode

Perform update.
protected performUpdate ( array $query ) : integer
$query array
Résultat integer

pluck() public méthode

Pluck a single column from the database.
public pluck ( string $column ) : mixed
$column string
Résultat mixed

pop() public méthode

Remove the last element from the array key.
public pop ( string $column, integer $type = 1 ) : integer
$column string
$type integer
Résultat integer

pull() public méthode

Remove one value from the array key.
public pull ( string $column, mixed $value = null ) : integer
$column string
$value mixed
Résultat integer

pullAll() public méthode

Remove several value from the array key.
public pullAll ( string $column, mixed $value = null ) : integer
$column string
$value mixed
Résultat integer

push() public méthode

Append one value to the array key.
public push ( string $column, mixed $value = null ) : integer
$column string
$value mixed
Résultat integer

pushAll() public méthode

Append several value to the array key.
public pushAll ( string $column, array $values ) : integer
$column string
$values array
Résultat integer

remember() public méthode

Indicate that the query results should be cached.
public remember ( integer $minutes, string $key = null ) : Builder
$minutes integer
$key string
Résultat Builder

remove() public méthode

Alias of delete.
public remove ( ) : integer
Résultat integer

renameField() public méthode

Renames a field.
public renameField ( mixed $old, mixed $new = null ) : integer
$old mixed
$new mixed
Résultat integer

resetQuery() public méthode

Reset the query
public resetQuery ( ) : void
Résultat void

save() public méthode

Save the document. Insert into the database if its not exists.
public save ( array $data ) : mixed
$data array
Résultat mixed

setConnection() public méthode

Set the database connection instance.
public setConnection ( Connection $connection ) : Connection
$connection LMongo\Connection
Résultat LMongo\Connection

setField() public méthode

Set the values for the keys.
public setField ( mixed $column, mixed $value = null ) : integer
$column mixed
$value mixed
Résultat integer

skip() public méthode

Set the "offset" value of the query.
public skip ( integer $value ) : LMongo\Query\Builder
$value integer
Résultat LMongo\Query\Builder

sum() public méthode

Retrieve the sum of the values of a given column.
public sum ( string $column, array $query = [] ) : mixed
$column string
$query array
Résultat mixed

take() public méthode

Set the "limit" value of the query.
public take ( integer $value ) : LMongo\Query\Builder
$value integer
Résultat LMongo\Query\Builder

truncate() public méthode

Drop the collection.
public truncate ( ) : void
Résultat void

unsetField() public méthode

Unset or remove the given keys.
public unsetField ( mixed $column ) : integer
$column mixed
Résultat integer

update() public méthode

Update a document in the database.
public update ( array $data ) : integer
$data array
Résultat integer

where() public méthode

Add a basic where clause to the query.
public where ( string $column, mixed $value = null, string $logic = 'first' ) : LMongo\Query\Builder
$column string
$value mixed
$logic string
Résultat LMongo\Query\Builder

whereAll() public méthode

Add an "$all comparison operation" clause to logical operation.
public whereAll ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

whereBetween() public méthode

Add a where between statement to logical operation.
public whereBetween ( string $column, integer $min, integer $max ) : LMongo\Query\Builder
$column string
$min integer
$max integer
Résultat LMongo\Query\Builder

whereExists() public méthode

Add an "$exists element operation" clause to logical operation.
public whereExists ( string $column, boolean $exists = true ) : LMongo\Query\Builder
$column string
$exists boolean
Résultat LMongo\Query\Builder

whereGeoIntersects() public méthode

Add an "$geoIntersects geospatial operation" clause to logical operation.
public whereGeoIntersects ( string $column, string $geometry, array $coords, string $boolean = 'first' ) : LMongo\Query\Builder
$column string
$geometry string
$coords array
$boolean string
Résultat LMongo\Query\Builder

whereGeoWithin() public méthode

Add an "$geoWithin geospatial operation" clause to logical operation.
public whereGeoWithin ( string $column, string $shape, array $coords, string $boolean = 'first' ) : LMongo\Query\Builder
$column string
$shape string
$coords array
$boolean string
Résultat LMongo\Query\Builder

whereGt() public méthode

Add an "$gt comparison operation" clause to logical operation.
public whereGt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

whereGte() public méthode

Add an "$gte comparison operation" clause to logical operation.
public whereGte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

whereIn() public méthode

Add an "$in comparison operation" clause to logical operation.
public whereIn ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

whereLike() public méthode

Add a like statement with $regex operation to logical operation.
public whereLike ( string $column, mixed $value, string $flags = 'im' ) : LMongo\Query\Builder
$column string
$value mixed
$flags string
Résultat LMongo\Query\Builder

whereLt() public méthode

Add an "$lt comparison operation" clause to logical operation.
public whereLt ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

whereLte() public méthode

Add an "$lte comparison operation" clause to logical operation.
public whereLte ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

whereMod() public méthode

Add an "$mod element operation" clause to logical operation.
public whereMod ( string $column, integer $divisor, integer $remainder ) : LMongo\Query\Builder
$column string
$divisor integer
$remainder integer
Résultat LMongo\Query\Builder

whereNe() public méthode

Add an "$ne comparison operation" clause to logical operation.
public whereNe ( string $column, string $value ) : LMongo\Query\Builder
$column string
$value string
Résultat LMongo\Query\Builder

whereNear() public méthode

Add an "$near geospatial operation" clause to logical operation.
public whereNear ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null, string $boolean = 'first' ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
$boolean string
Résultat LMongo\Query\Builder

whereNearSphere() public méthode

Add an "$nearSphere geospatial operation" clause to logical operation.
public whereNearSphere ( string $column, array $coords, mixed $geometry = null, mixed $maxDistance = null, string $boolean = 'first' ) : LMongo\Query\Builder
$column string
$coords array
$geometry mixed
$maxDistance mixed
$boolean string
Résultat LMongo\Query\Builder

whereNested() public méthode

Add a nested where statement to the query.
public whereNested ( Closure $callback, string $logic = '$and' ) : LMongo\Query\Builder
$callback Closure
$logic string
Résultat LMongo\Query\Builder

whereNin() public méthode

Add an "$nin comparison operation" clause to logical operation.
public whereNin ( string $column, array $value ) : LMongo\Query\Builder
$column string
$value array
Résultat LMongo\Query\Builder

whereRegex() public méthode

Add an "$regex JavaScript operation" clause to logical operation.
public whereRegex ( string $column, mixed $value ) : LMongo\Query\Builder
$column string
$value mixed
Résultat LMongo\Query\Builder

whereSize() public méthode

Add an "$size array operation" clause to logical operation.
public whereSize ( string $column, integer $value ) : LMongo\Query\Builder
$column string
$value integer
Résultat LMongo\Query\Builder

whereType() public méthode

Add an "$type element operation" clause to logical operation.
public whereType ( string $column, integer $type ) : LMongo\Query\Builder
$column string
$type integer
Résultat LMongo\Query\Builder

Property Details

$cacheKey protected_oe property

The key that should be used when caching the query.
protected string $cacheKey
Résultat string

$cacheMinutes protected_oe property

The number of minutes to cache the query.
protected int $cacheMinutes
Résultat integer

$collection public_oe property

The database collection
public string $collection
Résultat string

$columns public_oe property

The columns that should be returned.
public array $columns
Résultat array

$connection protected_oe property

The database connection instance.
protected LMongo\Connection $connection
Résultat LMongo\Connection

$first protected_oe property

Indicates if the first where set or not.
protected bool $first
Résultat boolean

$limit public_oe property

The maximum number of documents to return.
public int $limit
Résultat integer

$offset public_oe property

The number of documents to skip.
public int $offset
Résultat integer

$orders public_oe property

The orderings for the query.
public array $orders
Résultat array

$wheres public_oe property

The where constraints for the query.
public array $wheres
Résultat array