PHP Class LMongo\Query\Builder

Datei anzeigen Open project: navruzm/lmongo Class Usage Examples

Public Properties

Property 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

Property 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.

Public Methods

Method 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.

Protected Methods

Method 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

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

Method Details

__construct() public method

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

addToSet() public method

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

aggregate() public method

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

andWhere() public method

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

andWhereAll() public method

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

andWhereBetween() public method

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
return LMongo\Query\Builder

andWhereExists() public method

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

andWhereGeoIntersects() public method

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
return LMongo\Query\Builder

andWhereGeoWithin() public method

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
return LMongo\Query\Builder

andWhereGt() public method

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

andWhereGte() public method

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

andWhereIn() public method

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

andWhereLike() public method

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
return LMongo\Query\Builder

andWhereLt() public method

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

andWhereLte() public method

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

andWhereMod() public method

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
return LMongo\Query\Builder

andWhereNe() public method

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

andWhereNear() public method

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
return LMongo\Query\Builder

andWhereNearSphere() public method

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
return LMongo\Query\Builder

andWhereNin() public method

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

andWhereRegex() public method

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

andWhereSize() public method

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

andWhereType() public method

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

avg() public method

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

batchInsert() public method

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

collection() public method

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

compileWhereBasic() protected method

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

compileWhereNested() protected method

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

compileWheres() public method

Compile the query
public compileWheres ( Builder $query ) : array
$query Builder
return array

count() public method

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

decrement() public method

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
return integer

delete() public method

Delete a document from the database.
public delete ( ) : integer
return integer

distinct() public method

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

exists() public method

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

find() public method

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

first() public method

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

forPage() public method

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

generateCacheKey() public method

Generate the unique cache key for the query.
public generateCacheKey ( ) : string
return string

get() public method

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

getAndResetWheres() public method

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

getCacheCallback() protected method

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

getCacheInfo() protected method

Get the cache key and cache minutes as an array.
protected getCacheInfo ( ) : array
return array

getCacheKey() public method

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

getCached() public method

Execute cached query.
public getCached ( array $columns = [] ) : array
$columns array
return array

getConnection() public method

Get the database connection instance.
public getConnection ( ) : Connection
return LMongo\Connection

getFresh() public method

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

group() public method

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
return LMongo\Query\Cursor

implode() public method

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

increment() public method

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
return integer

insert() public method

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

max() public method

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

min() public method

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

newQuery() public method

new Query Builder instance
public newQuery ( ) : Builder
return Builder

norWhere() public method

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

norWhereAll() public method

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

norWhereBetween() public method

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
return LMongo\Query\Builder

norWhereExists() public method

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

norWhereGeoIntersects() public method

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
return LMongo\Query\Builder

norWhereGeoWithin() public method

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
return LMongo\Query\Builder

norWhereGt() public method

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

norWhereGte() public method

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

norWhereIn() public method

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

norWhereLike() public method

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
return LMongo\Query\Builder

norWhereLt() public method

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

norWhereLte() public method

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

norWhereMod() public method

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
return LMongo\Query\Builder

norWhereNe() public method

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

norWhereNear() public method

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
return LMongo\Query\Builder

norWhereNearSphere() public method

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
return LMongo\Query\Builder

norWhereNin() public method

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

norWhereRegex() public method

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

norWhereSize() public method

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

norWhereType() public method

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

orWhere() public method

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

orWhereAll() public method

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

orWhereBetween() public method

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
return LMongo\Query\Builder

orWhereExists() public method

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

orWhereGeoIntersects() public method

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
return LMongo\Query\Builder

orWhereGeoWithin() public method

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
return LMongo\Query\Builder

orWhereGt() public method

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

orWhereGte() public method

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

orWhereIn() public method

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

orWhereLike() public method

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
return LMongo\Query\Builder

orWhereLt() public method

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

orWhereLte() public method

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

orWhereMod() public method

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
return LMongo\Query\Builder

orWhereNe() public method

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

orWhereNear() public method

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
return LMongo\Query\Builder

orWhereNearSphere() public method

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
return LMongo\Query\Builder

orWhereNin() public method

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

orWhereRegex() public method

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

orWhereSize() public method

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

orWhereType() public method

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

orderBy() public method

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

paginate() public method

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

performUpdate() protected method

Perform update.
protected performUpdate ( array $query ) : integer
$query array
return integer

pluck() public method

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

pop() public method

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

pull() public method

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

pullAll() public method

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

push() public method

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

pushAll() public method

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

remember() public method

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

remove() public method

Alias of delete.
public remove ( ) : integer
return integer

renameField() public method

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

resetQuery() public method

Reset the query
public resetQuery ( ) : void
return void

save() public method

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

setConnection() public method

Set the database connection instance.
public setConnection ( Connection $connection ) : Connection
$connection LMongo\Connection
return LMongo\Connection

setField() public method

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

skip() public method

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

sum() public method

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

take() public method

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

truncate() public method

Drop the collection.
public truncate ( ) : void
return void

unsetField() public method

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

update() public method

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

where() public method

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
return LMongo\Query\Builder

whereAll() public method

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

whereBetween() public method

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
return LMongo\Query\Builder

whereExists() public method

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

whereGeoIntersects() public method

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
return LMongo\Query\Builder

whereGeoWithin() public method

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
return LMongo\Query\Builder

whereGt() public method

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

whereGte() public method

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

whereIn() public method

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

whereLike() public method

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
return LMongo\Query\Builder

whereLt() public method

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

whereLte() public method

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

whereMod() public method

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
return LMongo\Query\Builder

whereNe() public method

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

whereNear() public method

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
return LMongo\Query\Builder

whereNearSphere() public method

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
return LMongo\Query\Builder

whereNested() public method

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

whereNin() public method

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

whereRegex() public method

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

whereSize() public method

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

whereType() public method

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

Property Details

$cacheKey protected_oe property

The key that should be used when caching the query.
protected string $cacheKey
return string

$cacheMinutes protected_oe property

The number of minutes to cache the query.
protected int $cacheMinutes
return integer

$collection public_oe property

The database collection
public string $collection
return string

$columns public_oe property

The columns that should be returned.
public array $columns
return array

$connection protected_oe property

The database connection instance.
protected LMongo\Connection $connection
return LMongo\Connection

$first protected_oe property

Indicates if the first where set or not.
protected bool $first
return boolean

$limit public_oe property

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

$offset public_oe property

The number of documents to skip.
public int $offset
return integer

$orders public_oe property

The orderings for the query.
public array $orders
return array

$wheres public_oe property

The where constraints for the query.
public array $wheres
return array