Constructor and Description |
---|
CouchbaseBucket(AsyncBucket asyncBucket,
CouchbaseEnvironment env,
ClusterFacade core,
String name,
String password)
Create a
CouchbaseBucket that relies on the provided AsyncBucket . |
CouchbaseBucket(CouchbaseEnvironment env,
ClusterFacade core,
String name,
String password,
List<Transcoder<? extends Document,?>> customTranscoders)
Create a
CouchbaseBucket that doesn’t reuse an existing AsyncBucket but rather creates one internally. |
Modifier and Type | Method and Description |
---|---|
<T> DocumentFragment<T> |
addUniqueIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo)
Adds a value in an existing array inside a
JSON document , with the default timeout. |
<T> DocumentFragment<T> |
addUniqueIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Adds a value in an existing array inside a
JSON document , with a custom timeout. |
<D extends Document<?>> |
append(D document)
Append a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
append(D document,
long timeout,
TimeUnit timeUnit)
Append a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
append(D document,
PersistTo persistTo)
Append a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
append(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Append a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
append(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Append a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
append(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Append a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
append(D document,
ReplicateTo replicateTo)
Append a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
append(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Append a
Document s content to an existing one with a custom timeout. |
<T> DocumentFragment<T> |
arrayInsertIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo)
Insert a value in an existing array inside a
JSON document , at a specific index as denoted by the path (eg. |
<T> DocumentFragment<T> |
arrayInsertIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert a value in an existing array inside a
JSON document , at a specific index as denoted by the path (eg. |
AsyncBucket |
async()
Provides access to the underlying asynchronous bucket interface.
|
BucketManager |
bucketManager()
Provides access to the
BucketManager for administrative access. |
Boolean |
close()
Closes this bucket with the default disconnect timeout.
|
Boolean |
close(long timeout,
TimeUnit timeUnit)
Closes this bucket with a custom timeout.
|
ClusterFacade |
core()
Returns the underlying “core-io” library through its
ClusterFacade . |
JsonLongDocument |
counter(String id,
long delta)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
PersistTo persistTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
PersistTo persistTo,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
int expiry,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
PersistTo persistTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
PersistTo persistTo,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long initial,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
PersistTo persistTo)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
|
JsonLongDocument |
counter(String id,
long delta,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
PersistTo persistTo,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
|
JsonLongDocument |
counter(String id,
long delta,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
|
JsonLongDocument |
counter(String id,
long delta,
ReplicateTo replicateTo)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
|
JsonLongDocument |
counter(String id,
long delta,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
|
DocumentFragment<Long> |
counterIn(DocumentFragment<Long> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo)
Increment or decrement a numerical value inside an existing
JSON document with the default timeout. |
DocumentFragment<Long> |
counterIn(DocumentFragment<Long> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Increment or decrement a numerical value inside an existing
JSON document with a custom timeout. |
CouchbaseEnvironment |
environment()
The
CouchbaseEnvironment used. |
<D extends Document<?>> |
exists(D document)
Check whether a document with the given ID does exist in the bucket.
|
<D extends Document<?>> |
exists(D document,
long timeout,
TimeUnit timeUnit)
Check whether a document with the given ID does exist in the bucket.
|
boolean |
exists(String id)
Check whether a document with the given ID does exist in the bucket.
|
boolean |
exists(String id,
long timeout,
TimeUnit timeUnit)
Check whether a document with the given ID does exist in the bucket.
|
boolean |
existsIn(String id,
String path)
Check for the existence of a path inside of a
JSON document , with the default timeout. |
boolean |
existsIn(String id,
String path,
long timeout,
TimeUnit timeUnit)
Check for the existence of a path inside of a
JSON document , with a custom timeout. |
<T> DocumentFragment<T> |
extendIn(DocumentFragment<T> fragment,
ExtendDirection direction,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo)
Extend an array inside a
JSON document , either pushing the new value at the front or at the back , with the default timeout. |
<T> DocumentFragment<T> |
extendIn(DocumentFragment<T> fragment,
ExtendDirection direction,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Extend an array inside a
JSON document , either pushing the new value at the front or at the back , with a custom timeout. |
<D extends Document<?>> |
get(D document)
Retrieves any type of
Document with the default key/value timeout. |
<D extends Document<?>> |
get(D document,
long timeout,
TimeUnit timeUnit)
Retrieves any type of
Document with a custom timeout. |
JsonDocument |
get(String id)
Retrieves a
JsonDocument by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
get(String id,
Class<D> target)
Retrieves any type of
Document by its ID with the default key/value timeout. |
<D extends Document<?>> |
get(String id,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Retrieves any type of
Document by its ID with a custom timeout. |
JsonDocument |
get(String id,
long timeout,
TimeUnit timeUnit)
Retrieves a
JsonDocument by its unique ID with a custom timeout. |
<D extends Document<?>> |
getAndLock(D document,
int lockTime)
Retrieve and lock a
Document by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndLock(D document,
int lockTime,
long timeout,
TimeUnit timeUnit)
Retrieve and lock a
Document by its unique ID with a custom timeout. |
JsonDocument |
getAndLock(String id,
int lockTime)
Retrieve and lock a
JsonDocument by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndLock(String id,
int lockTime,
Class<D> target)
Retrieve and lock a
Document by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndLock(String id,
int lockTime,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Retrieve and lock a
Document by its unique ID with the a custom timeout. |
JsonDocument |
getAndLock(String id,
int lockTime,
long timeout,
TimeUnit timeUnit)
Retrieve and lock a
JsonDocument by its unique ID with a custom timeout. |
<D extends Document<?>> |
getAndTouch(D document)
Retrieve and touch a
Document by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndTouch(D document,
long timeout,
TimeUnit timeUnit)
Retrieve and touch a
Document by its unique ID with a custom timeout. |
JsonDocument |
getAndTouch(String id,
int expiry)
Retrieve and touch a
JsonDocument by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndTouch(String id,
int expiry,
Class<D> target)
Retrieve and touch a
Document by its unique ID with the default key/value timeout. |
<D extends Document<?>> |
getAndTouch(String id,
int expiry,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Retrieve and touch a
Document by its unique ID with a custom timeout. |
JsonDocument |
getAndTouch(String id,
int expiry,
long timeout,
TimeUnit timeUnit)
Retrieve and touch a
JsonDocument by its unique ID with the a custom timeout. |
<D extends Document<?>> |
getFromReplica(D document)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(D document,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
<D extends Document<?>> |
getFromReplica(D document,
ReplicaMode type)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(D document,
ReplicaMode type,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
Iterator<JsonDocument> |
getFromReplica(String id)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(String id,
Class<D> target)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(String id,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
Iterator<JsonDocument> |
getFromReplica(String id,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
List<JsonDocument> |
getFromReplica(String id,
ReplicaMode type)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(String id,
ReplicaMode type,
Class<D> target)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with the default timeout. |
<D extends Document<?>> |
getFromReplica(String id,
ReplicaMode type,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
List<JsonDocument> |
getFromReplica(String id,
ReplicaMode type,
long timeout,
TimeUnit timeUnit)
Retrieves one or more, possibly stale, representations of a
JsonDocument by its unique ID with a custom timeout. |
<T> DocumentFragment<T> |
getIn(String id,
String path,
Class<T> fragmentType)
Retrieve a fragment of an existing
JSON document , as denoted by the given path, with the default timeout. |
<T> DocumentFragment<T> |
getIn(String id,
String path,
Class<T> fragmentType,
long timeout,
TimeUnit timeUnit)
Retrieve a fragment of an existing
JSON document , as denoted by the given path, with a custom timeout. |
<D extends Document<?>> |
insert(D document)
Insert a
Document if it does not exist already with the default key/value timeout. |
<D extends Document<?>> |
insert(D document,
long timeout,
TimeUnit timeUnit)
Insert a
Document if it does not exist already with a custom timeout. |
<D extends Document<?>> |
insert(D document,
PersistTo persistTo)
Insert a
Document if it does not exist already and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
insert(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Insert a
Document if it does not exist already and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
insert(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Insert a
Document if it does not exist already and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
insert(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert a
Document if it does not exist already and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
insert(D document,
ReplicateTo replicateTo)
Insert a
Document if it does not exist already and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
insert(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert a
Document if it does not exist already and watch for durability constraints with a custom timeout. |
<T> DocumentFragment<T> |
insertIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo)
Insert a fragment of JSON into an existing
JSON document , on the condition that no value already exist at this location, with a custom timeout. |
<T> DocumentFragment<T> |
insertIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert a fragment of JSON into an existing
JSON document , on the condition that no value already exist at this location, with a custom timeout. |
int |
invalidateQueryCache()
Invalidates and clears the internal query cache.
|
boolean |
isClosed()
Returns true if this bucket is already closed, false if it is still open.
|
MultiLookupResult |
lookupIn(String id,
long timeout,
TimeUnit timeUnit,
LookupSpec... lookupSpecs)
Perform several
lookup operations inside a single existing JSON document with a custom timeout. |
MultiLookupResult |
lookupIn(String id,
LookupSpec... lookupSpecs)
Perform several
lookup operations inside a single existing JSON document with the default timeout. |
String |
name()
The name of the
Bucket . |
<D extends Document<?>> |
prepend(D document)
Prepend a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
prepend(D document,
long timeout,
TimeUnit timeUnit)
Prepend a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
prepend(D document,
PersistTo persistTo)
Prepend a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
prepend(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Prepend a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
prepend(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Prepend a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
prepend(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Prepend a
Document s content to an existing one with a custom timeout. |
<D extends Document<?>> |
prepend(D document,
ReplicateTo replicateTo)
Prepend a
Document s content to an existing one with the default key/value timeout. |
<D extends Document<?>> |
prepend(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Prepend a
Document s content to an existing one with a custom timeout. |
N1qlQueryResult |
query(N1qlQuery query)
Experimental: Queries a N1QL secondary index with the
default query timeout . |
N1qlQueryResult |
query(N1qlQuery query,
long timeout,
TimeUnit timeUnit)
Experimental: Queries a N1QL secondary index with a custom timeout.
|
SearchQueryResult |
query(SearchQuery query)
Experimental: Queries a Full-Text Index
|
SearchQueryResult |
query(SearchQuery query,
long timeout,
TimeUnit timeUnit)
Experimental: Queries a Full-Text Index
|
SpatialViewResult |
query(SpatialViewQuery query)
Queries a Couchbase Server Spatial
View with the default view timeout . |
SpatialViewResult |
query(SpatialViewQuery query,
long timeout,
TimeUnit timeUnit)
Queries a Couchbase Server Spatial
View with a custom timeout. |
N1qlQueryResult |
query(Statement statement)
Experimental: Queries a N1QL secondary index with the
default query timeout . |
N1qlQueryResult |
query(Statement statement,
long timeout,
TimeUnit timeUnit)
Experimental: Queries a N1QL secondary index with a custom timeout.
|
ViewResult |
query(ViewQuery query)
Queries a Couchbase Server
View with the default view timeout . |
ViewResult |
query(ViewQuery query,
long timeout,
TimeUnit timeUnit)
Queries a Couchbase Server
View with a custom timeout. |
<D extends Document<?>> |
remove(D document)
Removes a
Document from the Server with the default key/value timeout. |
<D extends Document<?>> |
remove(D document,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server with a custom timeout. |
<D extends Document<?>> |
remove(D document,
PersistTo persistTo)
Removes a
Document from the Server and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server and apply a durability requirement with a custom timeout. |
<D extends Document<?>> |
remove(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Removes a
Document from the Server and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server and apply a durability requirement with a custom timeout. |
<D extends Document<?>> |
remove(D document,
ReplicateTo replicateTo)
Removes a
Document from the Server and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id)
Removes a
Document from the Server identified by its ID with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
Class<D> target)
Removes a
Document from the Server identified by its ID with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server identified by its ID with a custom timeout. |
JsonDocument |
remove(String id,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server identified by its ID with a custom timeout. |
JsonDocument |
remove(String id,
PersistTo persistTo)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
PersistTo persistTo,
Class<D> target)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
PersistTo persistTo,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id,
PersistTo persistTo,
ReplicateTo replicateTo)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
PersistTo persistTo,
ReplicateTo replicateTo,
Class<D> target)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
PersistTo persistTo,
ReplicateTo replicateTo,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id,
ReplicateTo replicateTo)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
ReplicateTo replicateTo,
Class<D> target)
Removes a
Document from the Server by its ID and apply a durability requirement with the default key/value timeout. |
<D extends Document<?>> |
remove(String id,
ReplicateTo replicateTo,
Class<D> target,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
JsonDocument |
remove(String id,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Removes a
Document from the Server by its ID and apply a durability requirement with a custom timeout. |
<T> DocumentFragment<T> |
removeIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo)
Removes an entry from an existing
JSON document , with the default timeout. |
<T> DocumentFragment<T> |
removeIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Removes an entry from an existing
JSON document , with a custom timeout. |
<D extends Document<?>> |
replace(D document)
Replace a
Document if it does already exist with the default key/value timeout. |
<D extends Document<?>> |
replace(D document,
long timeout,
TimeUnit timeUnit)
Replace a
Document if it does already exist with a custom timeout. |
<D extends Document<?>> |
replace(D document,
PersistTo persistTo)
Replace a
Document if it does exist and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
replace(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Replace a
Document if it does exist and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
replace(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Replace a
Document if it does exist and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
replace(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Replace a
Document if it does exist and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
replace(D document,
ReplicateTo replicateTo)
Replace a
Document if it does exist and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
replace(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Replace a
Document if it does exist and watch for durability constraints with a custom timeout. |
<T> DocumentFragment<T> |
replaceIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo)
Replace a fragment of JSON with another one inside an existing
JSON document , with the default timeout. |
<T> DocumentFragment<T> |
replaceIn(DocumentFragment<T> fragment,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Replace a fragment of JSON with another one inside an existing
JSON document , with a custom timeout. |
Repository |
repository()
The
Repository provides access to full object document mapping (ODM) capabilities. |
String |
toString() |
<D extends Document<?>> |
touch(D document)
Renews the expiration time of a
Document with the default key/value timeout. |
<D extends Document<?>> |
touch(D document,
long timeout,
TimeUnit timeUnit)
Renews the expiration time of a
Document with a custom timeout. |
Boolean |
touch(String id,
int expiry)
Renews the expiration time of a
Document with the default key/value timeout. |
Boolean |
touch(String id,
int expiry,
long timeout,
TimeUnit timeUnit)
Renews the expiration time of a
Document with a custom timeout. |
<D extends Document<?>> |
unlock(D document)
Unlocks a write-locked
Document with the default key/value timeout. |
<D extends Document<?>> |
unlock(D document,
long timeout,
TimeUnit timeUnit)
Unlocks a write-locked
Document with a custom timeout. |
Boolean |
unlock(String id,
long cas)
Unlocks a write-locked
Document with the default key/value timeout. |
Boolean |
unlock(String id,
long cas,
long timeout,
TimeUnit timeUnit)
Unlocks a write-locked
Document with a custom timeout. |
<D extends Document<?>> |
upsert(D document)
Insert or overwrite a
Document with the default key/value timeout. |
<D extends Document<?>> |
upsert(D document,
long timeout,
TimeUnit timeUnit)
Insert or overwrite a
Document with a custom timeout. |
<D extends Document<?>> |
upsert(D document,
PersistTo persistTo)
Insert or overwrite a
Document and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
upsert(D document,
PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Insert or overwrite a
Document and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
upsert(D document,
PersistTo persistTo,
ReplicateTo replicateTo)
Insert or overwrite a
Document and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
upsert(D document,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert or overwrite a
Document and watch for durability constraints with a custom timeout. |
<D extends Document<?>> |
upsert(D document,
ReplicateTo replicateTo)
Insert or overwrite a
Document and watch for durability constraints with the default key/value timeout. |
<D extends Document<?>> |
upsert(D document,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Insert or overwrite a
Document and watch for durability constraints with a custom timeout. |
<T> DocumentFragment<T> |
upsertIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo)
Upsert a fragment of JSON into an existing
JSON document , with the default timeout. |
<T> DocumentFragment<T> |
upsertIn(DocumentFragment<T> fragment,
boolean createParents,
PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Upsert a fragment of JSON into an existing
JSON document , with a custom timeout. |
public CouchbaseBucket(CouchbaseEnvironment env, ClusterFacade core, String name, String password, List<Transcoder<? extends Document,?>> customTranscoders)
Create a CouchbaseBucket
that doesn’t reuse an existing AsyncBucket
but rather creates one internally. Prefer using the alternative constructor CouchbaseBucket(CouchbaseEnvironment, ClusterFacade, String, String, List)
if you can obtain an AsyncBucket externally.
public CouchbaseBucket(AsyncBucket asyncBucket, CouchbaseEnvironment env, ClusterFacade core, String name, String password)
Create a CouchbaseBucket
that relies on the provided AsyncBucket
.
public AsyncBucket async()
Bucket
Provides access to the underlying asynchronous bucket interface.
public ClusterFacade core()
Bucket
Returns the underlying “core-io” library through its ClusterFacade
.
Handle with care, with great power comes great responsibility. All additional checks which are normally performed by this library are skipped.
core
in interface Bucket
ClusterFacade
from the “core-io” package.public CouchbaseEnvironment environment()
Bucket
The CouchbaseEnvironment
used.
environment
in interface Bucket
public Repository repository()
Bucket
The Repository
provides access to full object document mapping (ODM) capabilities.
It allows you to work with POJO entities only and use annotations to customize the behaviour and mapping characteristics.
repository
in interface Bucket
public JsonDocument get(String id)
Bucket
Retrieves a JsonDocument
by its unique ID with the default key/value timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, null is returned.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.get
in interface Bucket
id
- the unique ID of the document.JsonDocument
or null if not found.public JsonDocument get(String id, long timeout, TimeUnit timeUnit)
Bucket
Retrieves a JsonDocument
by its unique ID with a custom timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, null is returned.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.get
in interface Bucket
id
- the unique ID of the document.timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
or null if not found.public <D extends Document<?>> D get(D document)
Bucket
Retrieves any type of Document
with the default key/value timeout.
The document ID is taken out of the Document
provided, as well as the target type to return. Note that not the same document is returned, but rather a new one of the same type with the freshly loaded properties.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D get(D document, long timeout, TimeUnit timeUnit)
Bucket
Retrieves any type of Document
with a custom timeout.
The document ID is taken out of the Document
provided, as well as the target type to return. Note that not the same document is returned, but rather a new one of the same type with the freshly loaded properties.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D get(String id, Class<D> target)
Bucket
Retrieves any type of Document
by its ID with the default key/value timeout.
The document ID is taken out of the Document
provided, as well as the target type to return. Note that not the same document is returned, but rather a new one of the same type with the freshly loaded properties.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D get(String id, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Retrieves any type of Document
by its ID with a custom timeout.
The document ID is taken out of the Document
provided, as well as the target type to return. Note that not the same document is returned, but rather a new one of the same type with the freshly loaded properties.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public boolean exists(String id)
Bucket
Check whether a document with the given ID does exist in the bucket.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public boolean exists(String id, long timeout, TimeUnit timeUnit)
Bucket
Check whether a document with the given ID does exist in the bucket.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> boolean exists(D document)
Bucket
Check whether a document with the given ID does exist in the bucket.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> boolean exists(D document, long timeout, TimeUnit timeUnit)
Bucket
Check whether a document with the given ID does exist in the bucket.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public List<JsonDocument> getFromReplica(String id, ReplicaMode type)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- id the unique ID of the document.type
- the ReplicaMode
to select.JsonDocument
s.public List<JsonDocument> getFromReplica(String id, ReplicaMode type, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- id the unique ID of the document.type
- the ReplicaMode
to select.timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
s.public <D extends Document<?>> List<D> getFromReplica(D document, ReplicaMode type)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
document
- the document to extract the ID from.type
- the ReplicaMode
to select.JsonDocument
s.public <D extends Document<?>> List<D> getFromReplica(D document, ReplicaMode type, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
document
- the document to extract the ID from.type
- the ReplicaMode
to select.timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
s.public <D extends Document<?>> List<D> getFromReplica(String id, ReplicaMode type, Class<D> target)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the id of the document.type
- the ReplicaMode
to select.JsonDocument
s.public <D extends Document<?>> List<D> getFromReplica(String id, ReplicaMode type, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
Depending on the ReplicaMode
selected, there can be none to four JsonDocument
be returned from the Observable
. If ReplicaMode.FIRST
, ReplicaMode.SECOND
or ReplicaMode.THIRD
are selected zero or one documents are returned, if ReplicaMode.ALL
is used, all configured replicas plus the master node may return a document.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the id of the document.type
- the ReplicaMode
to select.target
- the target document type to use.timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
s.public Iterator<JsonDocument> getFromReplica(String id)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the unique ID of the document.public <D extends Document<?>> Iterator<D> getFromReplica(D document)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
document
- the document to extract the ID from.public <D extends Document<?>> Iterator<D> getFromReplica(String id, Class<D> target)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with the default timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the unique ID of the document.target
- the target document type to use.public <D extends Document<?>> Iterator<D> getFromReplica(String id, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the unique ID of the document.target
- the target document type to use.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> Iterator<D> getFromReplica(D document, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
document
- the document to extract the ID from.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public Iterator<JsonDocument> getFromReplica(String id, long timeout, TimeUnit timeUnit)
Bucket
Retrieves one or more, possibly stale, representations of a JsonDocument
by its unique ID with a custom timeout.
This method has the ReplicaMode.ALL
preselected. If you are only interested in the first (or just some) values, you can iterate and then break out of the iterator loop. Documents are pushed into the iterator as they arrive, which distinguishes this method from the List
equivalents which wait until all responses arrive.
If the document has not been replicated yet or if the replica or master are not available (because a node has been failed over), no response is expected from these nodes.
Since data is replicated asynchronously, all data returned from this method must be considered stale. If the appropriate ReplicateTo
constraints are set on write and the operation returns successfully, then the data can be considered as non-stale.
Note that the returning JsonDocument
responses can come in any order.
Because this method is considered to be a “last resort” call against the database if a regular get didn’t succeed, most errors are swallowed (but logged) and the Observable will return all successful responses.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
getFromReplica
in interface Bucket
id
- the unique ID of the document.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public JsonDocument getAndLock(String id, int lockTime)
Bucket
Retrieve and lock a JsonDocument
by its unique ID with the default key/value timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
id
- id the unique ID of the document.lockTime
- the time to write lock the document (max. 30 seconds).JsonDocument
or null.public JsonDocument getAndLock(String id, int lockTime, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and lock a JsonDocument
by its unique ID with a custom timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
id
- id the unique ID of the document.lockTime
- the time to write lock the document (max. 30 seconds).timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
or null.public <D extends Document<?>> D getAndLock(D document, int lockTime)
Bucket
Retrieve and lock a Document
by its unique ID with the default key/value timeout.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(Document)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
document
- the source document from which the ID is taken and the type is inferred.lockTime
- the time to write lock the document (max. 30 seconds).Document
or null.public <D extends Document<?>> D getAndLock(D document, int lockTime, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and lock a Document
by its unique ID with a custom timeout.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(Document)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
document
- the source document from which the ID is taken and the type is inferred.lockTime
- the time to write lock the document (max. 30 seconds).timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
or null.public <D extends Document<?>> D getAndLock(String id, int lockTime, Class<D> target)
Bucket
Retrieve and lock a Document
by its unique ID with the default key/value timeout.
This method differs from Bucket.getAndLock(String, int)
in that if a specific Document
type is passed in, the appropriate Transcoder
will be selected (and not JSON conversion).
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
id
- id the unique ID of the document.lockTime
- the time to write lock the document (max. 30 seconds).target
- the target document type to use.Document
or null.public <D extends Document<?>> D getAndLock(String id, int lockTime, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and lock a Document
by its unique ID with the a custom timeout.
This method differs from Bucket.getAndLock(String, int)
in that if a specific Document
type is passed in, the appropriate Transcoder
will be selected (and not JSON conversion).
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it (write) locks the document for the given lock time interval. Note that this lock time is hard capped to 30 seconds, even if provided with a higher value and is not configurable. The document will unlock afterwards automatically.
Detecting an already locked document is done by checking for TemporaryLockFailureException
. Note that this exception can also be raised in other conditions, always when the error is transient and retrying may help.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndLock
in interface Bucket
id
- id the unique ID of the document.lockTime
- the time to write lock the document (max. 30 seconds).target
- the target document type to use.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
or null.public JsonDocument getAndTouch(String id, int expiry)
Bucket
Retrieve and touch a JsonDocument
by its unique ID with the default key/value timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it touches the document, which will reset its configured expiration time to the value provided.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
id
- id the unique ID of the document.expiry
- the new expiration time for the document.JsonDocument
or null.public JsonDocument getAndTouch(String id, int expiry, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and touch a JsonDocument
by its unique ID with the a custom timeout.
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String)
, but in addition it touches the document, which will reset its configured expiration time to the value provided.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
id
- id the unique ID of the document.expiry
- the new expiration time for the document.timeout
- the custom timeout.timeUnit
- the unit for the timeout.JsonDocument
or null.public <D extends Document<?>> D getAndTouch(D document)
Bucket
Retrieve and touch a Document
by its unique ID with the default key/value timeout.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(Document)
, but in addition it touches the document, which will reset its configured expiration time set on the given document itself.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
document
- the source document from which the ID and expiry is taken and the type is inferred.Document
or null.public <D extends Document<?>> D getAndTouch(D document, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and touch a Document
by its unique ID with a custom timeout.
If the document is found, a Document
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(Document)
, but in addition it touches the document, which will reset its configured expiration time set on the given document itself.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
document
- the source document from which the ID and expiry is taken and the type is inferred.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
or null.public <D extends Document<?>> D getAndTouch(String id, int expiry, Class<D> target)
Bucket
Retrieve and touch a Document
by its unique ID with the default key/value timeout.
This method differs from Bucket.getAndTouch(String, int)
in that if a specific Document
type is passed in, the appropriate Transcoder
will be selected (and not JSON conversion).
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String, Class)
, but in addition it touches the document, which will reset its configured expiration time to the value provided.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
id
- id the unique ID of the document.expiry
- the new expiration time for the document.target
- the target document type to use.Document
or null.public <D extends Document<?>> D getAndTouch(String id, int expiry, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Retrieve and touch a Document
by its unique ID with a custom timeout.
This method differs from Bucket.getAndTouch(String, int)
in that if a specific Document
type is passed in, the appropriate Transcoder
will be selected (and not JSON conversion).
If the document is found, a JsonDocument
is returned. If the document is not found, the Observable
completes without an item emitted.
This method works similar to Bucket.get(String, Class)
, but in addition it touches the document, which will reset its configured expiration time to the value provided.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.getAndTouch
in interface Bucket
id
- id the unique ID of the document.expiry
- the new expiration time for the document.target
- the target document type to use.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
or null.public <D extends Document<?>> D insert(D document)
Bucket
Insert a Document
if it does not exist already with the default key/value timeout.
If the given Document
(identified by its unique ID) already exists, the observable errors with a DocumentAlreadyExistsException
. If the operation should also override the existing Document
, Bucket.upsert(Document)
should be used instead. It will always either return a document or fail with an error.
The returned Document
contains original properties, but has the refreshed CAS value set.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.insert(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestTooBigException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D insert(D document, long timeout, TimeUnit timeUnit)
Bucket
Insert a Document
if it does not exist already with a custom timeout.
If the given Document
(identified by its unique ID) already exists, the observable errors with a DocumentAlreadyExistsException
. If the operation should also override the existing Document
, Bucket.upsert(Document)
should be used instead. It will always either return a document or fail with an error.
The returned Document
contains original properties, but has the refreshed CAS value set.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.insert(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestTooBigException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D insert(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D insert(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D insert(D document, PersistTo persistTo)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D insert(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D insert(D document, ReplicateTo replicateTo)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D insert(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert a Document
if it does not exist already and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.insert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentAlreadyExistsException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original insert has already happened, so the actual insert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document)
Bucket
Insert or overwrite a Document
with the default key/value timeout.
If the given Document
(identified by its unique ID) already exists, it will be overridden by the current one. The returned Document
contains original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document)
method needs to be used.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.upsert(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestTooBigException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D upsert(D document, long timeout, TimeUnit timeUnit)
Bucket
Insert or overwrite a Document
with a custom timeout.
If the given Document
(identified by its unique ID) already exists, it will be overridden by the current one. The returned Document
contains original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, long, TimeUnit)
method needs to be used.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.upsert(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestTooBigException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D upsert(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Insert or overwrite a Document
and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, PersistTo, ReplicateTo)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert or overwrite a Document
and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, PersistTo, ReplicateTo, long, TimeUnit)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document, PersistTo persistTo)
Bucket
Insert or overwrite a Document
and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, PersistTo)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Insert or overwrite a Document
and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, PersistTo, long, TimeUnit)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document, ReplicateTo replicateTo)
Bucket
Insert or overwrite a Document
and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, ReplicateTo)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D upsert(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert or overwrite a Document
and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.upsert(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
Please note that this method will not use the Document.cas()
for optimistic concurrency checks. If this behavior is needed, the Bucket.replace(Document, ReplicateTo, long, TimeUnit)
method needs to be used.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original upsert has already happened, so the actual upsert and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document)
Bucket
Replace a Document
if it does already exist with the default key/value timeout.
If the given Document
(identified by its unique ID) does not exist already, the method errors with a DocumentDoesNotExistException
. If the operation should also insert the Document
, Bucket.upsert(Document)
should be used instead. It will always either return a document or fail with an error.
The returned Document
contains original properties, but has the refreshed CAS value set.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.replace(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D replace(D document, long timeout, TimeUnit timeUnit)
Bucket
Replace a Document
if it does already exist with a custom timeout.
If the given Document
(identified by its unique ID) does not exist already, the method errors with a DocumentDoesNotExistException
. If the operation should also insert the Document
, Bucket.upsert(Document)
should be used instead. It will always either return a document or fail with an error.
The returned Document
contains original properties, but has the refreshed CAS value set.
This operation will return successfully if the Document
has been acknowledged in the managed cache layer on the master server node. If increased data durability is a concern, Bucket.replace(Document, PersistTo, ReplicateTo)
should be used instead.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D replace(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Replace a Document
if it does exist and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Replace a Document
if it does exist and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document, PersistTo persistTo)
Bucket
Replace a Document
if it does exist and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Replace a Document
if it does exist and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document, ReplicateTo replicateTo)
Bucket
Replace a Document
if it does exist and watch for durability constraints with the default key/value timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D replace(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Replace a Document
if it does exist and watch for durability constraints with a custom timeout.
This method works exactly like Bucket.replace(Document)
, but afterwards watches the server states if the given durability constraints are met. If this is the case, a new document is returned which contains the original properties, but has the refreshed CAS value set.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
RequestTooBigException
DurabilityException
.CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original replace has already happened, so the actual replace and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D remove(D document)
Bucket
Removes a Document
from the Server with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Removes a Document
from the Server and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, PersistTo persistTo)
Bucket
Removes a Document
from the Server and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, ReplicateTo replicateTo)
Bucket
Removes a Document
from the Server and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.remove
in interface Bucket
document
- the document to remove, with the ID extracted.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D remove(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.Document
and it did not match with the server: CASMismatchException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id)
Bucket
Removes a Document
from the Server identified by its ID with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, PersistTo persistTo)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, ReplicateTo replicateTo)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server identified by its ID with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public JsonDocument remove(String id, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, Class<D> target)
Bucket
Removes a Document
from the Server identified by its ID with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, PersistTo persistTo, ReplicateTo replicateTo, Class<D> target)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, PersistTo persistTo, Class<D> target)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, ReplicateTo replicateTo, Class<D> target)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with the default key/value timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server identified by its ID with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, PersistTo persistTo, ReplicateTo replicateTo, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.remove
in interface Bucket
id
- the id of the document to remove.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.target
- the target document type to use.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D remove(String id, PersistTo persistTo, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public <D extends Document<?>> D remove(String id, ReplicateTo replicateTo, Class<D> target, long timeout, TimeUnit timeUnit)
Bucket
Removes a Document
from the Server by its ID and apply a durability requirement with a custom timeout.
The Document
returned just has the document ID and its CAS value set, since the value and all other associated properties have been removed from the server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DurabilityException
.TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
CouchbaseException
.public ViewResult query(ViewQuery query)
Bucket
Queries a Couchbase Server View
with the default view timeout
.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
ViewDoesNotExistException
public N1qlQueryResult query(Statement statement)
Bucket
Experimental: Queries a N1QL secondary index with the default query timeout
. Said timeout includes the time it takes to retrieve all of the rows and errors from server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
public N1qlQueryResult query(N1qlQuery query)
Bucket
Experimental: Queries a N1QL secondary index with the default query timeout
. Said timeout includes the time it takes to retrieve all of the rows and errors from server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
public SearchQueryResult query(SearchQuery query)
Bucket
Experimental: Queries a Full-Text Index
This method throws under the following conditions:
BackpressureException
RequestCancelledException
public SearchQueryResult query(SearchQuery query, long timeout, TimeUnit timeUnit)
Bucket
Experimental: Queries a Full-Text Index
This method throws under the following conditions:
BackpressureException
RequestCancelledException
public SpatialViewResult query(SpatialViewQuery query)
Bucket
Queries a Couchbase Server Spatial View
with the default view timeout
.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
ViewDoesNotExistException
public ViewResult query(ViewQuery query, long timeout, TimeUnit timeUnit)
Bucket
Queries a Couchbase Server View
with a custom timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
ViewDoesNotExistException
public SpatialViewResult query(SpatialViewQuery query, long timeout, TimeUnit timeUnit)
Bucket
Queries a Couchbase Server Spatial View
with a custom timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
ViewDoesNotExistException
public N1qlQueryResult query(Statement statement, long timeout, TimeUnit timeUnit)
Bucket
Experimental: Queries a N1QL secondary index with a custom timeout. Said timeout includes the time it takes to retrieve all of the rows and errors from server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
query
in interface Bucket
statement
- the statement in a DSL form (start with a static select() import)timeout
- the custom full timeout, including the time to retrieve all rows, errors, etc…timeUnit
- the unit for the timeout.public N1qlQueryResult query(N1qlQuery query, long timeout, TimeUnit timeUnit)
Bucket
Experimental: Queries a N1QL secondary index with a custom timeout. Said timeout includes the time it takes to retrieve all of the rows and errors from server.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
query
in interface Bucket
query
- the full N1qlQuery
, including statement and any other additional parameter.timeout
- the custom full timeout, including the time to retrieve all rows, errors, etc…timeUnit
- the unit for the timeout.public Boolean unlock(String id, long cas)
Bucket
Unlocks a write-locked Document
with the default key/value timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> Boolean unlock(D document)
Bucket
Unlocks a write-locked Document
with the default key/value timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public Boolean unlock(String id, long cas, long timeout, TimeUnit timeUnit)
Bucket
Unlocks a write-locked Document
with a custom timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> Boolean unlock(D document, long timeout, TimeUnit timeUnit)
Bucket
Unlocks a write-locked Document
with a custom timeout.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
DocumentDoesNotExistException
TemporaryLockFailureException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public Boolean touch(String id, int expiry)
Bucket
Renews the expiration time of a Document
with the default key/value timeout.
Compared to Bucket.getAndTouch(Document)
, this method does not actually fetch the document from the server, but it just resets its expiration time to the given value.
This method throws under the following conditions:
DocumentDoesNotExistException
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> Boolean touch(D document)
Bucket
Renews the expiration time of a Document
with the default key/value timeout.
Compared to Bucket.getAndTouch(Document)
, this method does not actually fetch the document from the server, but it just resets its expiration time to the given value.
This method throws under the following conditions:
DocumentDoesNotExistException
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public Boolean touch(String id, int expiry, long timeout, TimeUnit timeUnit)
Bucket
Renews the expiration time of a Document
with a custom timeout.
Compared to Bucket.getAndTouch(Document)
, this method does not actually fetch the document from the server, but it just resets its expiration time to the given value.
This method throws under the following conditions:
DocumentDoesNotExistException
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> Boolean touch(D document, long timeout, TimeUnit timeUnit)
Bucket
Renews the expiration time of a Document
with a custom timeout.
Compared to Bucket.getAndTouch(Document)
, this method does not actually fetch the document from the server, but it just resets its expiration time to the given value.
This method throws under the following conditions:
DocumentDoesNotExistException
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public JsonLongDocument counter(String id, long delta)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
.CouchbaseException
.public JsonLongDocument counter(String id, long delta, long initial)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public JsonLongDocument counter(String id, long delta, long initial, int expiry)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public JsonLongDocument counter(String id, long delta, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DocumentDoesNotExistException
.CouchbaseException
.public JsonLongDocument counter(String id, long delta, long initial, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public JsonLongDocument counter(String id, long delta, long initial, int expiry, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public BucketManager bucketManager()
Bucket
Provides access to the BucketManager
for administrative access.
The manager lets you perform operations such as flushing a bucket or creating and managing design documents.
bucketManager
in interface Bucket
public <D extends Document<?>> D append(D document)
Bucket
Append a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D prepend(D document)
Bucket
Prepend a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D append(D document, long timeout, TimeUnit timeUnit)
Bucket
Append a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public <D extends Document<?>> D prepend(D document, long timeout, TimeUnit timeUnit)
Bucket
Prepend a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
CouchbaseException
.public JsonLongDocument counter(String id, long delta, PersistTo persistTo)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with the default kvTimeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, long initial, PersistTo persistTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, long initial, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
public JsonLongDocument counter(String id, long delta, long initial, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.persistTo
- the persistence constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, PersistTo persistTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.persistTo
- the persistence constraint to watch.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.replicateTo
- the replication constraint to watch.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with the default key/value timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.persistTo
- the persistence constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value or throw an exception if it does not exist yet with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.DocumentDoesNotExistException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public JsonLongDocument counter(String id, long delta, long initial, int expiry, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a counter with the given value and a initial value if it does not exist with a custom timeout.
This method allows to set an expiration time for the document as well. It is not allowed that the delta value will bring the actual value below zero.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original increment/decrement has already happened, so the actual increment/decrement and the watching for durability constraints are two separate tasks internally.
counter
in interface Bucket
id
- the id of the document.delta
- the increment or decrement amount.initial
- the initial value.expiry
- the new expiration time of the counter.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.Document
containing the resulting value.public <D extends Document<?>> D append(D document, PersistTo persistTo)
Bucket
Append a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D append(D document, ReplicateTo replicateTo)
Bucket
Append a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D append(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Append a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
append
in interface Bucket
document
- the document, identified by its id, from which the content is appended to the existing one.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.public <D extends Document<?>> D append(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Append a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
append
in interface Bucket
document
- the document, identified by its id, from which the content is appended to the existing one.persistTo
- the persistence constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D append(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Append a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
append
in interface Bucket
document
- the document, identified by its id, from which the content is appended to the existing one.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D append(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Append a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the appended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original append has already happened, so the actual append and the watching for durability constraints are two separate tasks internally.
append
in interface Bucket
document
- the document, identified by its id, from which the content is appended to the existing one.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D prepend(D document, PersistTo persistTo)
Bucket
Prepend a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D prepend(D document, ReplicateTo replicateTo)
Bucket
Prepend a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
public <D extends Document<?>> D prepend(D document, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Prepend a Document
s content to an existing one with the default key/value timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
prepend
in interface Bucket
document
- the document, identified by its id, from which the content is prepended to the existing one.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.public <D extends Document<?>> D prepend(D document, PersistTo persistTo, long timeout, TimeUnit timeUnit)
Bucket
Prepend a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
prepend
in interface Bucket
document
- the document, identified by its id, from which the content is prepended to the existing one.persistTo
- the persistence constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D prepend(D document, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Prepend a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
prepend
in interface Bucket
document
- the document, identified by its id, from which the content is prepended to the existing one.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <D extends Document<?>> D prepend(D document, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Prepend a Document
s content to an existing one with a custom timeout.
The Document
returned explicitly has the Document.content()
set to null, because the server does not return the prepended result, so at this point the client does not know how the Document
now looks like. A separate Bucket.get(Document)
call needs to be issued in order to get the full current content.
If the Document
does not exist, it needs to be created upfront. Note that JsonDocument
s in all forms are not supported, it is advised that the following ones are used:
Note that this method does not support expiration on the Document
. If set, it will be ignored.
This method throws under the following conditions:
TimeoutException
wrapped in a RuntimeException
BackpressureException
RequestCancelledException
RequestTooBigException
DocumentDoesNotExistException
TemporaryFailureException
CouchbaseOutOfMemoryException
DurabilityException
.CouchbaseException
.A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability constraint cannot be met because either the bucket does not have enough replicas configured or they are not available in a failover event. As an example, if one replica is configured and ReplicateTo.TWO
is used, the observable is errored with a DurabilityException
. The same can happen if one replica is configured, but one node has been failed over and not yet rebalanced (hence, on a subset of the partitions there is no replica available). It is important to understand that the original prepend has already happened, so the actual prepend and the watching for durability constraints are two separate tasks internally.
prepend
in interface Bucket
document
- the document, identified by its id, from which the content is prepended to the existing one.persistTo
- the persistence constraint to watch.replicateTo
- the replication constraint to watch.timeout
- the custom timeout.timeUnit
- the unit for the timeout.public <T> DocumentFragment<T> getIn(String id, String path, Class<T> fragmentType)
Bucket
Retrieve a fragment of an existing JSON document
, as denoted by the given path, with the default timeout. The Observable
will be empty if the path could not be found inside the document.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
Other error conditions include document-level error conditions (similar to those of Bucket.get(Document)
) and some generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
getIn
in interface Bucket
id
- the JSON document’s id to look into.path
- the path to look for inside the JSON content.fragmentType
- the type of the fragment value to be retrieved (so it can be directly casted).DocumentFragment
corresponding to the requested value, or null if the path could not be found.public <T> DocumentFragment<T> getIn(String id, String path, Class<T> fragmentType, long timeout, TimeUnit timeUnit)
Bucket
Retrieve a fragment of an existing JSON document
, as denoted by the given path, with a custom timeout. The Observable
will be empty if the path could not be found inside the document.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
Other error conditions include document-level error conditions (similar to those of Bucket.get(Document)
) and some generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
getIn
in interface Bucket
id
- the JSON document’s id to look into.path
- the path to look for inside the JSON content.fragmentType
- the type of the fragment value to be retrieved (so it can be directly casted).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the requested value, or null if the path could not be found.public boolean existsIn(String id, String path)
Bucket
Check for the existence of a path inside of a JSON document
, with the default timeout. For example “sub.some” will check that there is a JSON object called “sub” at the root of the document and that it contains a “some” entry (which could be a scalar, array or another sub-object).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
Other error conditions include document-level error conditions (similar to those of Bucket.get(Document)
) and some generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
public boolean existsIn(String id, String path, long timeout, TimeUnit timeUnit)
Bucket
Check for the existence of a path inside of a JSON document
, with a custom timeout. For example “sub.some” will check that there is a JSON object called “sub” at the root of the document and that it contains a “some” entry (which could be a scalar, array or another sub-object).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
Other error conditions include document-level error conditions (similar to those of Bucket.get(Document)
) and some generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
public <T> DocumentFragment<T> upsertIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Upsert a fragment of JSON into an existing JSON document
, with the default timeout. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
If the last element of the path doesn’t exist, it will be created. Otherwise, the current value at this location in the JSON is replaced by the one in the DocumentFragment.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
createParents
is set to false: PathNotFoundException
.PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
Contrary to document-level Bucket.upsert(Document)
, the document’s CAS is actually taken into account if provided in the fragment parameter, and the internal mutation will be rejected if the enclosing document was externally modified.
upsertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to apply.createParents
- truepersistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> upsertIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Upsert a fragment of JSON into an existing JSON document
, with a custom timeout. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
If the last element of the path doesn’t exist, it will be created. Otherwise, the current value at this location in the JSON is replaced by the one in the DocumentFragment.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
createParents
is set to false: PathNotFoundException
.PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
Contrary to document-level Bucket.upsert(Document)
, the document’s CAS is actually taken into account if provided in the fragment parameter, and the internal mutation will be rejected if the enclosing document was externally modified.
upsertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to apply.createParents
- truepersistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> insertIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Insert a fragment of JSON into an existing JSON document
, on the condition that no value already exist at this location, with a custom timeout. The document id and path inside the JSON where this insertion should happen are given by the DocumentFragment
.
Unless createParents
is set to true, only the last element of the path is created.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
createParents
is set to false: PathNotFoundException
.PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
insertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to insert.createParents
- truepersistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> insertIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert a fragment of JSON into an existing JSON document
, on the condition that no value already exist at this location, with a custom timeout. The document id and path inside the JSON where this insertion should happen are given by the DocumentFragment
.
Unless createParents
is set to true, only the last element of the path is created.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
createParents
is set to false: PathNotFoundException
.PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
insertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to insert.createParents
- truepersistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> replaceIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Replace a fragment of JSON with another one inside an existing JSON document
, with the default timeout. There should already be a value at this location. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
replaceIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to apply.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> replaceIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Replace a fragment of JSON with another one inside an existing JSON document
, with a custom timeout. There should already be a value at this location. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
replaceIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to mutate and containing the new value to apply.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> extendIn(DocumentFragment<T> fragment, ExtendDirection direction, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Extend an array inside a JSON document
, either pushing the new value at the front
or at the back
, with the default timeout. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
extendIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array to mutate and containing the new value to add to the array.direction
- the position in the array where to insert (start/front of array or end/back of array).createParents
- true if intermediate missing nodes in the path should also be created (effectively creating a new array).persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> extendIn(DocumentFragment<T> fragment, ExtendDirection direction, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Extend an array inside a JSON document
, either pushing the new value at the front
or at the back
, with a custom timeout. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
extendIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array to mutate and containing the new value to add to the array.direction
- the position in the array where to insert (start/front of array or end/back of array).createParents
- true if intermediate missing nodes in the path should also be created (effectively creating a new array).persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> arrayInsertIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Insert a value in an existing array inside a JSON document
, at a specific index as denoted by the path (eg. “some.array[2]”), with the default timeout. Existing values at the left of the index are shifted forward. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
. Index can be in the range 0-arraySize (inclusive).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathNotFoundException
PathInvalidException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
arrayInsertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array position at which to insert and containing the new value to add to the array.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> arrayInsertIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Insert a value in an existing array inside a JSON document
, at a specific index as denoted by the path (eg. “some.array[2]”), with a custom timeout. Existing values at the left of the index are shifted forward. The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
. Index can be in the range 0-arraySize (inclusive).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathNotFoundException
PathInvalidException
PathInvalidException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
arrayInsertIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array position at which to insert and containing the new value to add to the array.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> addUniqueIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Adds a value in an existing array inside a JSON document
, with the default timeout. This is provided said value isn’t already present in the array (as checked using string comparison). This is restricted to primitive values and arrays containing only primitives (no dictionary nor sub-array).
The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
PathMismatchException
CannotInsertValueException
PathExistsException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
addUniqueIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array in which to check and insert, containing the new value to add to the array.createParents
- set to true to create intermediary missing nodes and the array if it doesn’t exist.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> addUniqueIn(DocumentFragment<T> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Adds a value in an existing array inside a JSON document
, with a custom timeout. This is provided said value isn’t already present in the array (as checked using string comparison). This is restricted to primitive values and arrays containing only primitives (no dictionary nor sub-array).
The document id and path inside the JSON where this mutation should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
PathMismatchException
PathMismatchException
CannotInsertValueException
PathExistsException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
addUniqueIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the array in which to check and insert, containing the new value to add to the array.createParents
- set to true to create intermediary missing nodes and the array if it doesn’t exist.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the mutated value, with updated cas metadata.public <T> DocumentFragment<T> removeIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Removes an entry from an existing JSON document
, with the default timeout. This can be a scalar, whole dictionary or array or specific dictionary entry or array index, as denoted by the path. The last element in an array can also be removed by using the -1 index (eg. “some.array[-1]”).
The document id and path inside the JSON where this removal should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
IllegalArgumentException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
removeIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to remove (fragment value is ignored).persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the removed value, with updated cas metadata but no content.public <T> DocumentFragment<T> removeIn(DocumentFragment<T> fragment, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Removes an entry from an existing JSON document
, with a custom timeout. This can be a scalar, whole dictionary or array or specific dictionary entry or array index, as denoted by the path. The last element in an array can also be removed by using the -1 index (eg. “some.array[-1]”).
The document id and path inside the JSON where this removal should happen are given by the DocumentFragment
.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
PathNotFoundException
IllegalArgumentException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
removeIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the path to remove (fragment value is ignored).persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the removed value, with updated cas metadata but no content.public DocumentFragment<Long> counterIn(DocumentFragment<Long> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo)
Bucket
Increment or decrement a numerical value inside an existing JSON document
with the default timeout. The document id and path inside the JSON where this should happen, and the delta to apply, are given by the DocumentFragment
.
If the last element of the path doesn’t exist, it is created and initialized with the delta.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
ZeroDeltaException
Long.MAX_VALUE
or below/at Long.MIN_VALUE
: DeltaTooBigException
NumberTooBigException
PathMismatchException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
counterIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the numerical value to increment/decrement (fragment is the Long delta to apply) ignored).createParents
- true if intermediary missing nodes in the path should be created.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).DocumentFragment
corresponding to the modified value (contains the new value of the “counter”, with updated cas metadata).public DocumentFragment<Long> counterIn(DocumentFragment<Long> fragment, boolean createParents, PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
Bucket
Increment or decrement a numerical value inside an existing JSON document
with a custom timeout. The document id and path inside the JSON where this should happen, and the delta to apply, are given by the DocumentFragment
.
If the last element of the path doesn’t exist, it is created and initialized with the delta.
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document. The returned DocumentFragment
wraps the value and additional metadata like a reminder of the document’s id, the path, enclosing document’s cas (or MutationToken
).
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
CASMismatchException
DocumentNotJsonException
DocumentDoesNotExistException
ZeroDeltaException
Long.MAX_VALUE
or below/at Long.MIN_VALUE
: DeltaTooBigException
NumberTooBigException
PathMismatchException
DurabilityException
Other error conditions include document-level error conditions (similar to those of Bucket.replace(Document)
) and generic sub-document-level error conditions (all of which extend SubDocumentException
, like PathTooDeepException
).
counterIn
in interface Bucket
fragment
- a DocumentFragment
pointing to the numerical value to increment/decrement (fragment is the Long delta to apply) ignored).createParents
- true if intermediary missing nodes in the path should be created.persistTo
- the persistence constraint to watch (or NONE if not required).replicateTo
- the replication constraint to watch (or NONE if not required).timeout
- the custom timeout.timeUnit
- the unit for the timeout.DocumentFragment
corresponding to the modified value (contains the new value of the “counter”, with updated cas metadata).public MultiLookupResult lookupIn(String id, LookupSpec... lookupSpecs)
Bucket
Perform several lookup
operations inside a single existing JSON document
with the default timeout. The list of path to look for inside the JSON is represented through LookupSpecs
.
Each spec will receive an answer in the form of a LookupResult
, meaning that if sub-document level error conditions happen (like the path is malformed or doesn’t exist), the error condition is still represented as a LookupResult and the whole operation still succeeds.
MultiLookupResult
aggregates all these results and allows to check for such a partial failure (see MultiLookupResult.hasFailure()
, MultiLookupResult.isTotalFailure()
, …).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document.
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
NullPointerException
IllegalArgumentException
Each individual LookupResult
can have errors denoted by a “SUBDOC_” error status (eg. ResponseStatus.SUBDOC_PATH_MISMATCH
or ResponseStatus.SUBDOC_PATH_NOT_FOUND
), in which case the value is null. For Lookup.EXIST
, SUBDOC_PATH_NOT_FOUND is considered a “success” where LookupResult.exists()
returns false and LookupResult.value()
returns false as well.
If one prefers to deal with a SubDocumentException
instead of the ResponseStatus, one can use LookupResult.valueOrThrow()
.
One special fatal error can also happen that is represented as a LookupResult, when the value couldn’t be decoded from JSON. In that case, the ResponseStatus is ResponseStatus.FAILURE
and the value() is a TranscodingException
.
Other document-level error conditions are similar to those encountered during a document-level Bucket.get(Document)
.
lookupIn
in interface Bucket
id
- the id of the JSON document to look into.lookupSpecs
- the list of lookup operations to perform (use LookupSpec's static methods
)MultiLookupResult
representing the whole list of results (1 for each spec), unless a document-level error happened (in which case an exception is propagated).public MultiLookupResult lookupIn(String id, long timeout, TimeUnit timeUnit, LookupSpec... lookupSpecs)
Bucket
Perform several lookup
operations inside a single existing JSON document
with a custom timeout. The list of path to look for inside the JSON is represented through LookupSpecs
.
Each spec will receive an answer in the form of a LookupResult
, meaning that if sub-document level error conditions happen (like the path is malformed or doesn’t exist), the error condition is still represented as a LookupResult and the whole operation still succeeds.
MultiLookupResult
aggregates all these results and allows to check for such a partial failure (see MultiLookupResult.hasFailure()
, MultiLookupResult.isTotalFailure()
, …).
The subdocument API has the benefit of only transmitting the fragment of the document you work with on the wire, instead of the whole document.
This method throws under the following notable error conditions:
TimeoutException
wrapped in a RuntimeException
DocumentNotJsonException
DocumentDoesNotExistException
NullPointerException
IllegalArgumentException
Each individual LookupResult
can have errors denoted by a “SUBDOC_” error status (eg. ResponseStatus.SUBDOC_PATH_MISMATCH
or ResponseStatus.SUBDOC_PATH_NOT_FOUND
), in which case the value is null. For Lookup.EXIST
, SUBDOC_PATH_NOT_FOUND is considered a “success” where LookupResult.exists()
returns false and LookupResult.value()
returns false as well.
If one prefers to deal with a SubDocumentException
instead of the ResponseStatus, one can use LookupResult.valueOrThrow()
.
One special fatal error can also happen that is represented as a LookupResult, when the value couldn’t be decoded from JSON. In that case, the ResponseStatus is ResponseStatus.FAILURE
and the value() is a TranscodingException
.
Other document-level error conditions are similar to those encountered during a document-level Bucket.get(Document)
.
lookupIn
in interface Bucket
id
- the id of the JSON document to look into.timeout
- the custom timeout.timeUnit
- the unit for the timeout.lookupSpecs
- the list of lookup operations to perform (use LookupSpec's static methods
)MultiLookupResult
representing the whole list of results (1 for each spec), unless a document-level error happened (in which case an exception is propagated).public Boolean close()
Bucket
Closes this bucket with the default disconnect timeout.
public Boolean close(long timeout, TimeUnit timeUnit)
Bucket
Closes this bucket with a custom timeout.
public boolean isClosed()
Bucket
Returns true if this bucket is already closed, false if it is still open.
public int invalidateQueryCache()
Bucket
Invalidates and clears the internal query cache.
This method can be used to explicitly clear the internal N1QL query cache. This cache will be filled with non-adhoc query statements (query plans) to speed up those subsequent executions.
Triggering this method will wipe out the complete cache, which will not cause an interruption but rather all queries need to be re-prepared internally. This method is likely to be deprecated in the future once the server side query engine distributes its state throughout the cluster.
This method will not throw under any conditions.
invalidateQueryCache
in interface Bucket
Copyright © 2015 Couchbase, Inc.