Skip to content

Query

  • Full name: \Qubus\NoSql\Query

Constants

Constant Visibility Type Value
TYPE_GET public 'get'
TYPE_INSERT public 'insert'
TYPE_UPDATE public 'update'
TYPE_DELETE public 'delete'
TYPE_SAVE public 'save'

Properties

collection

protected ?\Qubus\NoSql\Collection $collection

pipes

protected array $pipes

Methods

__construct

public __construct(\Qubus\NoSql\Collection $collection): mixed

Parameters:

Parameter Type Description
$collection \Qubus\NoSql\Collection

getCollection

public getCollection(): \Qubus\NoSql\Collection

setCollection

public setCollection(\Qubus\NoSql\Collection $collection): void

Parameters:

Parameter Type Description
$collection \Qubus\NoSql\Collection

where

Where filter.

public where(mixed $filter): self

Parameters:

Parameter Type Description
$filter mixed

orWhere

Or where filter.

public orWhere(mixed $filter): self

Parameters:

Parameter Type Description
$filter mixed

map

public map(\Closure $mapper): static

Parameters:

Parameter Type Description
$mapper \Closure

select

public select(array $columns): static

Parameters:

Parameter Type Description
$columns array

withOne

1:1 relation

public withOne(\Qubus\NoSql\Collection|\Qubus\NoSql\Query $relation, string $as, string $otherKey, string $operator = '=', string $thisKey = '_id'): \Qubus\NoSql\Query

Parameters:

Parameter Type Description
$relation \Qubus\NoSql\Collection|\Qubus\NoSql\Query
$as string
$otherKey string
$operator string
$thisKey string

Throws:


withMany

1:n relation

public withMany(\Qubus\NoSql\Collection|\Qubus\NoSql\Query $relation, string $as, string $otherKey, string $operator = '=', string $thisKey = '_id'): \Qubus\NoSql\Query

Parameters:

Parameter Type Description
$relation \Qubus\NoSql\Collection|\Qubus\NoSql\Query
$as string
$otherKey string
$operator string
$thisKey string

Throws:


sortBy

Sort results.

public sortBy(string|\Closure $key, string $asc = 'asc'): \Qubus\NoSql\Query

Parameters:

Parameter Type Description
$key string|\Closure
$asc string

Throws:


skip

public skip(int $offset): static

Parameters:

Parameter Type Description
$offset int

take

public take(int $limit, int $offset): static

Parameters:

Parameter Type Description
$limit int
$offset int

get

Fetching a set of records in collection.

public get(array $select = []): mixed

If you want to retrieve a specific column define the column in the $select array.

Parameters:

Parameter Type Description
$select array

first

Fetch (one) record in a collection.

public first(array $select = []): mixed

If you want to retrieve a specific column(s) define the column in the $select array.

Parameters:

Parameter Type Description
$select array

update

public update(array $new): mixed

Parameters:

Parameter Type Description
$new array

Throws:


delete

public delete(): mixed

Throws:


save

public save(): mixed

Throws:


count

public count(): int

sum

public sum(mixed $key): mixed

Parameters:

Parameter Type Description
$key mixed

avg

public avg(mixed $key): int|float

Parameters:

Parameter Type Description
$key mixed

lists

public lists(string $key, mixed $resultKey = null): array

Parameters:

Parameter Type Description
$key string
$resultKey mixed

pluck

public pluck(string $key, mixed $resultKey = null): array

Parameters:

Parameter Type Description
$key string
$resultKey mixed

min

public min(string $key): mixed

Parameters:

Parameter Type Description
$key string

max

public max(mixed $key): mixed

Parameters:

Parameter Type Description
$key mixed

getPipes

public getPipes(): array

execute

protected execute(string $type, array $arg = []): mixed

Parameters:

Parameter Type Description
$type string
$arg array

Throws:


addWhere

protected addWhere(mixed $type, mixed $filter): mixed

Parameters:

Parameter Type Description
$type mixed
$filter mixed

Throws:


addFilter

protected addFilter(\Closure $filter, string $type = 'AND'): void

Parameters:

Parameter Type Description
$filter \Closure
$type string

addMapper

protected addMapper(\Closure $mapper): void

Parameters:

Parameter Type Description
$mapper \Closure

addSorter

protected addSorter(\Closure $value, string $asc): void

Parameters:

Parameter Type Description
$value \Closure
$asc string

getLimiter

protected getLimiter(): \Qubus\NoSql\Pipes\LimiterPipe

addPipe

protected addPipe(\Qubus\NoSql\Pipes\Pipe $pipe): void

Parameters:

Parameter Type Description
$pipe \Qubus\NoSql\Pipes\Pipe

getLastPipe

protected getLastPipe(): mixed

__call

public __call(mixed $method, mixed $args): mixed

Parameters:

Parameter Type Description
$method mixed
$args mixed

Throws:



Automatically generated on 2025-10-13