CollectionFind
class CollectionFind implements Executable, CrudOperationBindable, CrudOperationLimitable, CrudOperationSortable (View source)
Class CollectionFind
Methods
Bind value to query placeholder It allows the user to bind a parameter to the placeholder in the search condition of the find operation. The placeholder has the form of :NAME where ':' is a common prefix that must always exists before any NAME, NAME is the actual name of the placeholder. The bind function accepts a list of placeholders if multiple entities have to be substituted in the search condition.
Defined the columns for the query to return. If not defined then all columns are used.
This function can be used to group the result-set by one more columns, frequently this is used with aggregate functions like COUNT,MAX,MIN,SUM etc.
This function can be used after the 'field' operation in order to make a selection on the documents to extract.
Set the maximum number of documents to return.
Execute operation with EXCLUSIVE LOCK
Execute operation with SHARED LOCK
Skip given number of elements to be returned
Set the sorting criteria
Details
CrudOperationBindable
bind(array $placeholder_values)
Bind value to query placeholder It allows the user to bind a parameter to the placeholder in the search condition of the find operation. The placeholder has the form of :NAME where ':' is a common prefix that must always exists before any NAME, NAME is the actual name of the placeholder. The bind function accepts a list of placeholders if multiple entities have to be substituted in the search condition.
Result
execute()
Execute the find operation; this functionality allows for method chaining.
CollectionFind
fields(string $projection)
Defined the columns for the query to return. If not defined then all columns are used.
CollectionFind
groupBy(string $sort_expr)
This function can be used to group the result-set by one more columns, frequently this is used with aggregate functions like COUNT,MAX,MIN,SUM etc.
CollectionFind
having(string $sort_expr)
This function can be used after the 'field' operation in order to make a selection on the documents to extract.
CrudOperationLimitable
limit(int $rows)
Set the maximum number of documents to return.
CollectionFind
lockExclusive(int $lock_waiting_option)
Execute operation with EXCLUSIVE LOCK
Lock exclusively the document, other transactions are blocked from updating the document until the document is locked While the document is locked, other transactions are blocked from updating those docs, from doing SELECT ... LOCK IN SHARE MODE, or from reading the data in certain transaction isolation levels. Consistent reads ignore any locks set on the records that exist in the read view. This feature is directly useful with the modify() command, to avoid concurrency problems. Basically, it serializes access to a row through row locking
CollectionFind
lockShared(int $lock_waiting_option)
Execute operation with SHARED LOCK
Allows to share the documents between multiple transactions which are locking in shared mode. Other sessions can read the rows, but cannot modify them until your transaction commits. If any of these rows were changed by another transaction that has not yet committed, your query waits until that transaction ends and then uses the latest values.
CollectionFind
offset(int $position)
Skip given number of elements to be returned
Skip (offset) these number of elements that otherwise would be returned by the find operation. Use with the limit() method. Defining an offset larger than the result set size results in an empty set.
CrudOperationSortable
sort(string $sort_expr)
Set the sorting criteria
Sort the result set by the field selected in the sort_expr argument. The allowed orders are ASC (Ascending) or DESC (Descending). This operation is equivalent to the 'ORDER BY' SQL operation and it follows the same set of rules.