Collection
class Collection (View source)
Collection is an object containing functionality for performing KeyValue operations against the server.
Methods
Get the name of the collection.
Gets a document from the server, locking the document so that no other processes can perform mutations against it.
Gets a document from the server and simultaneously updates its expiry time.
Gets a document from any replica server in the cluster.
Gets a document from the active server and all replica servers in the cluster.
Creates a document if it doesn't exist, otherwise updates it.
Inserts a document if it doesn't exist, errors if it does exist.
Replaces a document if it exists, errors if it doesn't exist.
Unlocks a document which was locked using getAndLock. This frees the document to be modified by other processes.
Touches a document, setting a new expiry time.
Performs a set of subdocument lookup operations against the document.
Performs a set of subdocument lookup operations against the document.
Retrieves a group of documents. If the document does not exist, it will not raise an exception, but rather fill non-null value in error() property of the corresponding result object.
Removes a group of documents. If second element of the entry (CAS) is null, then the operation will remove the document unconditionally.
Creates a group of documents if they don't exist, otherwise updates them.
Creates and returns a BinaryCollection object for use with binary type documents.
Details
string
name()
Get the name of the collection.
GetResult
get(string $id, GetOptions $options = null)
Gets a document from the server.
This can take 3 paths, a standard full document fetch, a subdocument full document fetch also fetching document expiry (when withExpiry is set), or a subdocument fetch (when projections are used).
ExistsResult
exists(string $id, ExistsOptions $options = null)
Checks if a document exists on the server.
GetResult
getAndLock(string $id, int $lockTime, GetAndLockOptions $options = null)
Gets a document from the server, locking the document so that no other processes can perform mutations against it.
GetResult
getAndTouch(string $id, int $expiry, GetAndTouchOptions $options = null)
Gets a document from the server and simultaneously updates its expiry time.
GetReplicaResult
getAnyReplica(string $id, GetAnyReplicaOptions $options = null)
Gets a document from any replica server in the cluster.
array
getAllReplicas(string $id, GetAllReplicasOptions $options = null)
Gets a document from the active server and all replica servers in the cluster.
Returns an array of documents, one per server.
MutationResult
upsert(string $id, mixed $value, UpsertOptions $options = null)
Creates a document if it doesn't exist, otherwise updates it.
MutationResult
insert(string $id, mixed $value, InsertOptions $options = null)
Inserts a document if it doesn't exist, errors if it does exist.
MutationResult
replace(string $id, mixed $value, ReplaceOptions $options = null)
Replaces a document if it exists, errors if it doesn't exist.
MutationResult
remove(string $id, RemoveOptions $options = null)
Removes a document.
Result
unlock(string $id, string $cas, UnlockOptions $options = null)
Unlocks a document which was locked using getAndLock. This frees the document to be modified by other processes.
MutationResult
touch(string $id, int $expiry, TouchOptions $options = null)
Touches a document, setting a new expiry time.
LookupInResult
lookupIn(string $id, array $specs, LookupInOptions $options = null)
Performs a set of subdocument lookup operations against the document.
MutateInResult
mutateIn(string $id, array $specs, MutateInOptions $options = null)
Performs a set of subdocument lookup operations against the document.
array
getMulti(array $ids, RemoveOptions $options = null)
Retrieves a group of documents. If the document does not exist, it will not raise an exception, but rather fill non-null value in error() property of the corresponding result object.
array
removeMulti(array $entries, RemoveOptions $options = null)
Removes a group of documents. If second element of the entry (CAS) is null, then the operation will remove the document unconditionally.
array
upsertMulti(array $entries, UpsertOptions $options = null)
Creates a group of documents if they don't exist, otherwise updates them.
BinaryCollection
binary()
Creates and returns a BinaryCollection object for use with binary type documents.