Class Collection
Collection
provides blocking, synchronous access to all collection APIs.
If asynchronous access is needed, we recommend looking at the ReactiveCollection
and
if the last drop of performance is needed the AsyncCollection
. This blocking API itself
is just a small layer on top of the AsyncCollection
which blocks the current thread
until the request completes with a response.
- Since:
- 3.0.0
-
Method Summary
Modifier and TypeMethodDescriptionasync()
Provides access to the underlyingAsyncCollection
.binary()
Provides access to the binary APIs, not used for JSON documents.Returns the name of the bucket associated with this collection.core()
Provides access to the underlyingCore
.Provides access to the underlyingClusterEnvironment
.Checks if the given document ID exists on the active partition.exists
(String id, ExistsOptions options) Checks if the given document ID exists on the active partition with custom options.Fetches the full document from this collection.get
(String id, GetOptions options) Fetches the full document from this collection with custom options.getAllReplicas
(String id) Reads from all available replicas and the active node and returns the results as a stream.getAllReplicas
(String id, GetAllReplicasOptions options) Reads all available or one replica and returns the results as a stream with custom options.getAndLock
(String id, Duration lockTime) Fetches a full document and write-locks it for the given duration.getAndLock
(String id, Duration lockTime, GetAndLockOptions options) Fetches a full document and write-locks it for the given duration with custom options.getAndTouch
(String id, Duration expiry) Fetches a full document and resets its expiration time to the expiry provided.getAndTouch
(String id, Duration expiry, GetAndTouchOptions options) Fetches a full document and resets its expiration time to the expiry provided with custom options.getAndTouch
(String id, Instant expiry) Fetches a full document and resets its expiration time to the expiry provided.getAndTouch
(String id, Instant expiry, GetAndTouchOptions options) Fetches a full document and resets its expiration time to the expiry provided with custom options.getAnyReplica
(String id) Reads all available replicas, and returns the first found.getAnyReplica
(String id, GetAnyReplicaOptions options) Reads all available replicas, and returns the first found with custom options.Inserts a full document which does not exist yet.insert
(String id, Object content, InsertOptions options) Inserts a full document which does not exist yet with custom options.<T> List
<T> Returns aCouchbaseArrayList
backed by this collection, creating a new empty one if none exists already<T> List
<T> list
(String id, Class<T> entityType, ArrayListOptions options) Returns aCouchbaseArrayList
backed by this collection, creating a new empty one if none exists alreadylookupIn
(String id, List<LookupInSpec> specs) Performs lookups to document fragments with default options.lookupIn
(String id, List<LookupInSpec> specs, LookupInOptions options) Performs lookups to document fragments with custom options.lookupInAllReplicas
(String id, List<LookupInSpec> lookupInSpecs) Reads from all available replicas and the active node and returns the results as a stream.lookupInAllReplicas
(String id, List<LookupInSpec> lookupInSpecs, LookupInAllReplicasOptions options) Reads all available or one replica and returns the results as a stream with custom options.lookupInAnyReplica
(String id, List<LookupInSpec> lookupInSpecs) Reads all available replicas, and returns the first found.lookupInAnyReplica
(String id, List<LookupInSpec> lookupInSpecs, LookupInAnyReplicaOptions options) Reads all available replicas, and returns the first found with custom options.Returns aCouchbaseMap
backed by this collection, creating a new empty one if none exists already.map
(String id, Class<T> entityType, MapOptions options) Returns aCouchbaseMap
backed by this collection, creating a new empty one if none exists already.mutateIn
(String id, List<MutateInSpec> specs) Performs mutations to document fragments with default options.mutateIn
(String id, List<MutateInSpec> specs, MutateInOptions options) Performs mutations to document fragments with custom options.name()
Returns the name of this collection.Provides access to query index management at the Collection level.<T> Queue
<T> Returns aCouchbaseQueue
backed by this collection, creating a new empty one if none exists.<T> Queue
<T> queue
(String id, Class<T> entityType, QueueOptions options) Returns aCouchbaseQueue
backed by this collection, creating a new empty one if none exists.reactive()
Provides access to the underlyingReactiveCollection
.Removes a Document from a collection.remove
(String id, RemoveOptions options) Removes a Document from a collection with custom options.Replaces a full document which already exists.replace
(String id, Object content, ReplaceOptions options) Replaces a full document which already exists with custom options.Returns a stream ofScanResults
performing a Key-Value range scan with default options.scan
(ScanType scanType, ScanOptions options) Returns a stream ofScanResults
performing a Key-Value range scan with custom options.Returns the name of the scope associated with this collection.<T> Set
<T> Returns aCouchbaseArraySet
backed by this collection, create a new empty one if none exists already.<T> Set
<T> set
(String id, Class<T> entityType, ArraySetOptions options) Returns aCouchbaseArraySet
backed by this collection, create a new empty one if none exists already.Updates the expiry of the document with the given id.touch
(String id, Duration expiry, TouchOptions options) Updates the expiry of the document with the given id with custom options.Updates the expiry of the document with the given id.touch
(String id, Instant expiry, TouchOptions options) Updates the expiry of the document with the given id with custom options.void
Unlocks a document if it has been locked previously.void
unlock
(String id, long cas, UnlockOptions options) Unlocks a document if it has been locked previously, with custom options.Upserts a full document which might or might not exist yet.upsert
(String id, Object content, UpsertOptions options) Upserts a full document which might or might not exist yet with custom options.
-
Method Details
-
async
Provides access to the underlyingAsyncCollection
.- Returns:
- returns the underlying
AsyncCollection
.
-
reactive
Provides access to the underlyingReactiveCollection
.- Returns:
- returns the underlying
ReactiveCollection
.
-
name
Returns the name of this collection. -
bucketName
Returns the name of the bucket associated with this collection. -
scopeName
Returns the name of the scope associated with this collection. -
core
Provides access to the underlyingCore
. -
environment
Provides access to the underlyingClusterEnvironment
. -
binary
Provides access to the binary APIs, not used for JSON documents.- Returns:
- the
BinaryCollection
.
-
queryIndexes
Provides access to query index management at the Collection level. -
get
Fetches the full document from this collection.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
get
Fetches the full document from this collection with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.options
- options to customize the get request.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndLock
Fetches a full document and write-locks it for the given duration.Note that the client does not enforce an upper limit on the
Duration
lockTime. The maximum lock time by default on the server is 30 seconds. Any value larger than 30 seconds will be capped down by the server to the default lock time, which is 15 seconds unless modified on the server side.- Parameters:
id
- the document id which is used to uniquely identify it.lockTime
- how long to write-lock the document for (any duration > 30s will be capped to server default of 15s).- Returns:
- a
GetResult
once the document has been locked and loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndLock
Fetches a full document and write-locks it for the given duration with custom options.Note that the client does not enforce an upper limit on the
Duration
lockTime. The maximum lock time by default on the server is 30 seconds. Any value larger than 30 seconds will be capped down by the server to the default lock time, which is 15 seconds unless modified on the server side.- Parameters:
id
- the document id which is used to uniquely identify it.lockTime
- how long to write-lock the document for (any duration > 30s will be capped to server default of 15s).options
- options to customize the get and lock request.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndTouch
Fetches a full document and resets its expiration time to the expiry provided.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiration time for the document.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndTouch
Fetches a full document and resets its expiration time to the expiry provided with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiration time for the document.options
- options to customize the get and touch request.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndTouch
Fetches a full document and resets its expiration time to the expiry provided.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiration time for the document.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAndTouch
Fetches a full document and resets its expiration time to the expiry provided with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiration time for the document.options
- options to customize the get and touch request.- Returns:
- a
GetResult
once the document has been loaded. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAllReplicas
Reads from all available replicas and the active node and returns the results as a stream.Note that individual errors are ignored, so you can think of this API as a best effort approach which explicitly emphasises availability over consistency.
- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- a stream of results from the active and the replica.
- Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAllReplicas
Reads all available or one replica and returns the results as a stream with custom options.By default all available replicas and the active node will be asked and returned as an async stream. If configured differently in the options
- Parameters:
id
- the document id which is used to uniquely identify it.options
- the custom options.- Returns:
- a stream of results from the active and the replica depending on the options.
- Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAnyReplica
Reads all available replicas, and returns the first found.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- the first available result, might be the active or a replica.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
getAnyReplica
Reads all available replicas, and returns the first found with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.options
- the custom options.- Returns:
- the first available result, might be the active or a replica.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
exists
Checks if the given document ID exists on the active partition.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- a
ExistsResult
completing once loaded or failed. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
exists
Checks if the given document ID exists on the active partition with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- a
ExistsResult
completing once loaded or failed. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
remove
Removes a Document from a collection.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- a
MutationResult
once removed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
remove
Removes a Document from a collection with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.options
- custom options to change the default behavior.- Returns:
- a
MutationResult
once removed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
insert
Inserts a full document which does not exist yet.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to insert.- Returns:
- a
MutationResult
once inserted. - Throws:
DocumentExistsException
- the given document id is already present in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
insert
Inserts a full document which does not exist yet with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to insert.options
- custom options to customize the insert behavior.- Returns:
- a
MutationResult
once inserted. - Throws:
DocumentExistsException
- the given document id is already present in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
upsert
Upserts a full document which might or might not exist yet.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to upsert.- Returns:
- a
MutationResult
once upserted. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
upsert
Upserts a full document which might or might not exist yet with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to upsert.options
- custom options to customize the upsert behavior.- Returns:
- a
MutationResult
once upserted. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
replace
Replaces a full document which already exists.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to replace.- Returns:
- a
MutationResult
once replaced. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
replace
Replaces a full document which already exists with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.content
- the document content to replace.options
- custom options to customize the replace behavior.- Returns:
- a
MutationResult
once replaced. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
touch
Updates the expiry of the document with the given id.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiry for the document.- Returns:
- a
MutationResult
once the operation completes. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
touch
Updates the expiry of the document with the given id with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiry for the document.options
- the custom options.- Returns:
- a
MutationResult
once the operation completes. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
touch
Updates the expiry of the document with the given id.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiry for the document.- Returns:
- a
MutationResult
once the operation completes. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
touch
Updates the expiry of the document with the given id with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.expiry
- the new expiry for the document.options
- the custom options.- Returns:
- a
MutationResult
once the operation completes. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
unlock
Unlocks a document if it has been locked previously.- Parameters:
id
- the document id which is used to uniquely identify it.cas
- the CAS value which is needed to unlock it.- Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
unlock
Unlocks a document if it has been locked previously, with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.cas
- the CAS value which is needed to unlock it.options
- the options to customize.- Throws:
DocumentNotFoundException
- the given document id is not found in the collection.CasMismatchException
- if the document has been concurrently modified on the server.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupIn
Performs lookups to document fragments with default options.- Parameters:
id
- the document id which is used to uniquely identify it.specs
- the spec which specifies the type of lookups to perform.- Returns:
- the
LookupInResult
once the lookup has been performed or failed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupIn
Performs lookups to document fragments with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.specs
- the spec which specifies the type of lookups to perform.options
- custom options to modify the lookup options.- Returns:
- the
LookupInResult
once the lookup has been performed or failed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupInAllReplicas
@SinceCouchbase("7.6") public Stream<LookupInReplicaResult> lookupInAllReplicas(String id, List<LookupInSpec> lookupInSpecs) Reads from all available replicas and the active node and returns the results as a stream.Note that individual errors are ignored, so you can think of this API as a best effort approach which explicitly emphasises availability over consistency.
- Parameters:
id
- the document id which is used to uniquely identify it.lookupInSpecs
- specifies the type of lookups to perform.- Returns:
- a stream of results from the active and the replica.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.FeatureNotAvailableException
- if none of the requests return SUCCESSCouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupInAllReplicas
@SinceCouchbase("7.6") public Stream<LookupInReplicaResult> lookupInAllReplicas(String id, List<LookupInSpec> lookupInSpecs, LookupInAllReplicasOptions options) Reads all available or one replica and returns the results as a stream with custom options.By default all available replicas and the active node will be asked and returned as an async stream. If configured differently in the options
- Parameters:
id
- the document id which is used to uniquely identify it.lookupInSpecs
- specifies the type of lookups to perform.options
- the custom options.- Returns:
- a stream of results from the active and the replica depending on the options.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.FeatureNotAvailableException
- if none of the requests return SUCCESSCouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupInAnyReplica
@SinceCouchbase("7.6") public LookupInReplicaResult lookupInAnyReplica(String id, List<LookupInSpec> lookupInSpecs) Reads all available replicas, and returns the first found.- Parameters:
id
- the document id which is used to uniquely identify it.- Returns:
- the first available result, might be the active or a replica.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.FeatureNotAvailableException
- if none of the requests return SUCCESSCouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
lookupInAnyReplica
@SinceCouchbase("7.6") public LookupInReplicaResult lookupInAnyReplica(String id, List<LookupInSpec> lookupInSpecs, LookupInAnyReplicaOptions options) Reads all available replicas, and returns the first found with custom options.- Parameters:
id
- the document id which is used to uniquely identify it.options
- the custom options.- Returns:
- the first available result, might be the active or a replica.
- Throws:
DocumentUnretrievableException
- no document retrievable with a successful status.TimeoutException
- if the operation times out before getting a result.FeatureNotAvailableException
- if none of the requests return SUCCESSCouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
mutateIn
Performs mutations to document fragments with default options.- Parameters:
id
- the outer document ID.specs
- the spec which specifies the type of mutations to perform.- Returns:
- the
MutateInResult
once the mutation has been performed or failed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection and replace mode is selected.DocumentExistsException
- the given document id is already present in the collection and insert is was selected.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
mutateIn
Performs mutations to document fragments with custom options.- Parameters:
id
- the outer document ID.specs
- the spec which specifies the type of mutations to perform.options
- custom options to modify the mutation options.- Returns:
- the
MutateInResult
once the mutation has been performed or failed. - Throws:
DocumentNotFoundException
- the given document id is not found in the collection and replace mode is selected.DocumentExistsException
- the given document id is already present in the collection and insert is was selected.TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
list
Returns aCouchbaseArrayList
backed by this collection, creating a new empty one if none exists already- Parameters:
id
- the list's document id.entityType
- the class of the values contained in the set- Returns:
- a
CouchbaseArrayList
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
list
Returns aCouchbaseArrayList
backed by this collection, creating a new empty one if none exists already- Parameters:
id
- the list's document id.entityType
- the class of the values contained in the setoptions
- aArrayListOptions
to use for all operations on this instance of the list.- Returns:
- a
CouchbaseArrayList
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
set
Returns aCouchbaseArraySet
backed by this collection, create a new empty one if none exists already.- Parameters:
id
- the set's document id.entityType
- the class of the values contained in the set- Returns:
- a
CouchbaseArraySet
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
set
Returns aCouchbaseArraySet
backed by this collection, create a new empty one if none exists already.- Parameters:
id
- the set's document id.entityType
- the class of the values contained in the setoptions
- aArraySetOptions
to use for all operations on this instance of the set.- Returns:
- a
CouchbaseArraySet
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
map
Returns aCouchbaseMap
backed by this collection, creating a new empty one if none exists already. This map will haveString
keys, and values of Class- Parameters:
id
- the map's document id.entityType
- the class of the values contained the map, the keys areString
s.- Returns:
- a
CouchbaseMap
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
map
Returns aCouchbaseMap
backed by this collection, creating a new empty one if none exists already. This map will haveString
keys, and values of Class- Parameters:
id
- the map's document id.entityType
- the class of the values contained the map, the keys areString
s.options
- aMapOptions
to use for all operations on this instance of the map.- Returns:
- a
CouchbaseMap
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
queue
Returns aCouchbaseQueue
backed by this collection, creating a new empty one if none exists.- Parameters:
id
- the queue's document id.entityType
- the class of the values contained in the queue.- Returns:
- a
CouchbaseQueue
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
queue
Returns aCouchbaseQueue
backed by this collection, creating a new empty one if none exists.- Parameters:
id
- the queue's document id.entityType
- the class of the values contained in the queue.options
- aQueueOptions
to use for all operations on this instance of the queue.- Returns:
- a
CouchbaseQueue
. - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
scan
Returns a stream ofScanResults
performing a Key-Value range scan with default options.CAVEAT: This method is suitable for use cases that require relatively low concurrency and tolerate relatively high latency. If your application does many scans at once, or requires low latency results, we recommend using SQL++ (with a primary index on the collection) instead.
- Parameters:
scanType
- the type or range scan to perform.- Returns:
- a stream of
ScanResults
(potentially empty). - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-
scan
Returns a stream ofScanResults
performing a Key-Value range scan with custom options.CAVEAT: This method is suitable for use cases that require relatively low concurrency and tolerate relatively high latency. If your application does many scans at once, or requires low latency results, we recommend using SQL++ (with a primary index on the collection) instead.
- Parameters:
scanType
- the type or range scan to perform.options
- aScanOptions
to customize the behavior of the scan operation.- Returns:
- a stream of
ScanResults
(potentially empty). - Throws:
TimeoutException
- if the operation times out before getting a result.CouchbaseException
- for all other error reasons (acts as a base type and catch-all).
-