ViewQuery
class ViewQuery implements ViewQueryEncodable (View source)
Represents regular Couchbase Map/Reduce View query
Constants
UPDATE_BEFORE |
Force a view update before returning data |
UPDATE_NONE |
Allow stale views |
UPDATE_AFTER |
Allow stale view, update view after it has been accessed. |
ORDER_ASCENDING |
|
ORDER_DESCENDING |
|
Methods
Creates a new Couchbase ViewQuery instance for performing a view query.
Creates a new Couchbase ViewQuery instance for performing a spatial query.
Returns associative array, representing the View query.
Specifies the mode of updating to perorm before and after executing the query
Specifies whether the reduction function should be applied to results of the query.
Specify the group level to be used.
Specifies a range of the keys to return from the index.
Specifies start and end document IDs in addition to range limits.
Details
static ViewQuery
from(string $designDocumentName, string $viewName)
Creates a new Couchbase ViewQuery instance for performing a view query.
static SpatialViewQuery
fromSpatial(string $designDocumentName, string $viewName)
Creates a new Couchbase ViewQuery instance for performing a spatial query.
array
encode()
Returns associative array, representing the View query.
ViewQuery
limit(int $limit)
Limits the result set to a specified number rows.
ViewQuery
skip(int $skip)
Skips a number o records rom the beginning of the result set
ViewQuery
consistency(int $consistency)
Specifies the mode of updating to perorm before and after executing the query
ViewQuery
order(int $order)
Orders the results by key as specified
ViewQuery
reduce(bool $reduce)
Specifies whether the reduction function should be applied to results of the query.
ViewQuery
group(bool $group)
Group the results using the reduce function to a group or single row.
Important: this setter and groupLevel should not be used together in the same ViewQuery. It is sufficient to only set the grouping level only and use this setter in cases where you always want the highest group level implictly.
ViewQuery
groupLevel(int $groupLevel)
Specify the group level to be used.
Important: group() and this setter should not be used together in the same ViewQuery. It is sufficient to only use this setter and use group() in cases where you always want the highest group level implictly.
ViewQuery
key(mixed $key)
Restict results of the query to the specified key
ViewQuery
keys(array $keys)
Restict results of the query to the specified set of keys
ViewQuery
range(mixed $startKey, mixed $endKey, bool $inclusiveEnd = false)
Specifies a range of the keys to return from the index.
ViewQuery
idRange(string $startKeyDocumentId, string $endKeyDocumentId)
Specifies start and end document IDs in addition to range limits.
This might be needed for more precise pagination with a lot of documents with the same key selected into the same page.
ViewQuery
custom(array $customParameters)
Specifies custom options to pass to the server.
Note that these options are expected to be already encoded.