@InterfaceStability.Committed @InterfaceAudience.Public public class MutateInBuilder extends Object
execute()
method. Operations are performed synchronously (see AsyncMutateInBuilder
for an
asynchronous version).
Instances of this builder should be obtained through Bucket.mutateIn(String)
rather than directly
constructed.Constructor and Description |
---|
MutateInBuilder(AsyncMutateInBuilder asyncBuilder,
long defaultTimeout,
TimeUnit defaultTimeUnit)
Instances of this builder should be obtained through
Bucket.mutateIn(String) rather than directly
constructed. |
Modifier and Type | Method and Description |
---|---|
<T> MutateInBuilder |
arrayAddUnique(String path,
T value)
Insert a value in an existing array only if the value
isn't already contained in the array (by way of string comparison).
|
<T> MutateInBuilder |
arrayAddUnique(String path,
T value,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
arrayAddUnique(String path,
T value,
SubdocOptionsBuilder optionsBuilder)
Insert a value in an existing array only if the value
isn't already contained in the array (by way of string comparison).
|
<T> MutateInBuilder |
arrayAppend(String path,
T value)
Append to an existing array, pushing the value to the back/last position in
the array.
|
<T> MutateInBuilder |
arrayAppend(String path,
T value,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
arrayAppend(String path,
T value,
SubdocOptionsBuilder optionsBuilder)
Append to an existing array, pushing the value to the back/last position in
the array.
|
<T> MutateInBuilder |
arrayAppendAll(String path,
Collection<T> values,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
arrayAppendAll(String path,
Collection<T> values,
SubdocOptionsBuilder optionsBuilder)
Append multiple values at once in an existing array, pushing all values in the collection's iteration order to
the back/end of the array.
|
<T> MutateInBuilder |
arrayAppendAll(String path,
T... values)
Append multiple values at once in an existing array, pushing all values to the back/end of the array.
|
<T> MutateInBuilder |
arrayInsert(String path,
T value)
Insert into an existing array at a specific position
(denoted in the path, eg.
|
<T> MutateInBuilder |
arrayInsert(String path,
T value,
SubdocOptionsBuilder optionsBuilder)
Insert into an existing array at a specific position
(denoted in the path, eg.
|
<T> MutateInBuilder |
arrayInsertAll(String path,
Collection<T> values)
Insert multiple values at once in an existing array at a specified position (denoted in the
path, eg.
|
<T> MutateInBuilder |
arrayInsertAll(String path,
Collection<T> values,
SubdocOptionsBuilder optionsBuilder)
Insert multiple values at once in an existing array at a specified position (denoted in the
path, eg.
|
<T> MutateInBuilder |
arrayInsertAll(String path,
T... values)
Insert multiple values at once in an existing array at a specified position (denoted in the
path, eg.
|
<T> MutateInBuilder |
arrayPrepend(String path,
T value)
Prepend to an existing array, pushing the value to the front/first position in
the array.
|
<T> MutateInBuilder |
arrayPrepend(String path,
T value,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
arrayPrepend(String path,
T value,
SubdocOptionsBuilder optionsBuilder)
Prepend to an existing array, pushing the value to the front/first position in
the array.
|
<T> MutateInBuilder |
arrayPrependAll(String path,
Collection<T> values,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
arrayPrependAll(String path,
Collection<T> values,
SubdocOptionsBuilder optionsBuilder)
Prepend multiple values at once in an existing array, pushing all values in the collection's iteration order to
the front/start of the array.
|
<T> MutateInBuilder |
arrayPrependAll(String path,
T... values)
Prepend multiple values at once in an existing array, pushing all values to the front/start of the array.
|
MutateInBuilder |
counter(String path,
long delta)
Increment/decrement a numerical fragment in a JSON document.
|
MutateInBuilder |
counter(String path,
long delta,
boolean createPath)
Deprecated.
|
MutateInBuilder |
counter(String path,
long delta,
SubdocOptionsBuilder optionsBuilder)
Increment/decrement a numerical fragment in a JSON document.
|
MutateInBuilder |
createDocument(boolean createDocument)
Deprecated.
|
DocumentFragment<Mutation> |
execute()
Perform several
mutation operations inside a single existing JSON document ,
with the default key/value timeout. |
DocumentFragment<Mutation> |
execute(long timeout,
TimeUnit timeUnit)
Perform several
mutation operations inside a single existing JSON document ,
with a specific timeout. |
DocumentFragment<Mutation> |
execute(PersistTo persistTo)
Perform several
mutation operations inside a single existing JSON document ,
with the default key/value timeout and durability requirements. |
DocumentFragment<Mutation> |
execute(PersistTo persistTo,
long timeout,
TimeUnit timeUnit)
Perform several
mutation operations inside a single existing JSON document ,
with a specific timeout and durability requirements. |
DocumentFragment<Mutation> |
execute(PersistTo persistTo,
ReplicateTo replicateTo)
Perform several
mutation operations inside a single existing JSON document ,
with the default key/value timeout and durability requirements. |
DocumentFragment<Mutation> |
execute(PersistTo persistTo,
ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Perform several
mutation operations inside a single existing JSON document ,
with a specific timeout and durability requirements. |
DocumentFragment<Mutation> |
execute(ReplicateTo replicateTo)
Perform several
mutation operations inside a single existing JSON document ,
with the default key/value timeout and durability requirements. |
DocumentFragment<Mutation> |
execute(ReplicateTo replicateTo,
long timeout,
TimeUnit timeUnit)
Perform several
mutation operations inside a single existing JSON document ,
with a specific timeout and durability requirements. |
<T> MutateInBuilder |
insert(String path,
T fragment)
Insert a fragment provided the last element of the path doesn't exists.
|
<T> MutateInBuilder |
insert(String path,
T fragment,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
insert(String path,
T fragment,
SubdocOptionsBuilder optionsBuilder)
Insert a fragment provided the last element of the path doesn't exists.
|
MutateInBuilder |
insertDocument(boolean insertDocument)
Set insertDocument to true, if the document has to be created only if it does not exist
|
<T> MutateInBuilder |
remove(String path)
Remove an entry in a JSON document (scalar, array element, dictionary entry,
whole array or dictionary, depending on the path).
|
<T> MutateInBuilder |
remove(String path,
SubdocOptionsBuilder optionsBuilder)
Remove an entry in a JSON document (scalar, array element, dictionary entry,
whole array or dictionary, depending on the path).
|
<T> MutateInBuilder |
replace(String path,
T fragment)
Replace an existing value by the given fragment.
|
String |
toString() |
MutateInBuilder |
upsert(JsonObject content)
Upsert a full JSON document that doesn't exist.
|
<T> MutateInBuilder |
upsert(String path,
T fragment)
Insert a fragment, replacing the old value if the path exists.
|
<T> MutateInBuilder |
upsert(String path,
T fragment,
boolean createPath)
Deprecated.
|
<T> MutateInBuilder |
upsert(String path,
T fragment,
SubdocOptionsBuilder optionsBuilder)
Insert a fragment, replacing the old value if the path exists.
|
MutateInBuilder |
upsertDocument(boolean upsertDocument)
Set upsertDocument to true, if the document has to be created.
|
MutateInBuilder |
withCas(long cas)
Apply the whole mutation using optimistic locking, checking against the provided CAS value.
|
MutateInBuilder |
withDurability(PersistTo persistTo)
Set a persistence durability constraint for the whole mutation.
|
MutateInBuilder |
withDurability(PersistTo persistTo,
ReplicateTo replicateTo)
Set both a persistence and replication durability constraints for the whole mutation.
|
MutateInBuilder |
withDurability(ReplicateTo replicateTo)
Set a replication durability constraint for the whole mutation.
|
MutateInBuilder |
withExpiry(int expiry)
Change the expiry of the enclosing document as part of the mutation.
|
@InterfaceAudience.Private public MutateInBuilder(AsyncMutateInBuilder asyncBuilder, long defaultTimeout, TimeUnit defaultTimeUnit)
Bucket.mutateIn(String)
rather than directly
constructed.public DocumentFragment<Mutation> execute()
mutation
operations inside a single existing JSON document
,
with the default key/value timeout.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(PersistTo persistTo, ReplicateTo replicateTo)
mutation
operations inside a single existing JSON document
,
with the default key/value timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**persistTo
- the persistence requirement to watch.replicateTo
- the replication requirement to watch.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(PersistTo persistTo)
mutation
operations inside a single existing JSON document
,
with the default key/value timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**persistTo
- the persistence requirement to watch.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(ReplicateTo replicateTo)
mutation
operations inside a single existing JSON document
,
with the default key/value timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**replicateTo
- the replication requirement to watch.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(long timeout, TimeUnit timeUnit)
mutation
operations inside a single existing JSON document
,
with a specific timeout.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following most notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.timeout
- the specific timeout to apply for the operation.timeUnit
- the time unit for the timeout.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(PersistTo persistTo, ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
mutation
operations inside a single existing JSON document
,
with a specific timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**persistTo
- the persistence requirement to watch.replicateTo
- the replication requirement to watch.timeout
- the specific timeout to apply for the operation.timeUnit
- the time unit for the timeout.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(PersistTo persistTo, long timeout, TimeUnit timeUnit)
mutation
operations inside a single existing JSON document
,
with a specific timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**persistTo
- the persistence requirement to watch.timeout
- the specific timeout to apply for the operation.timeUnit
- the time unit for the timeout.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public DocumentFragment<Mutation> execute(ReplicateTo replicateTo, long timeout, TimeUnit timeUnit)
mutation
operations inside a single existing JSON document
,
with a specific timeout and durability requirements.
The list of mutations and paths to mutate in the JSON is added through builder methods like
arrayInsert(String, Object)
.
Multi-mutations are applied as a whole, atomically at the document level. That means that if one of the mutations
fails, none of the mutations are applied. Otherwise, all mutations can be considered successful and the whole
operation will receive a DocumentFragment
with the updated cas (and optionally MutationToken
).
The subdocument API has the benefit of only transmitting the fragment of the document you want to mutate
on the wire, instead of the whole document.
This operation throws under the following notable error conditions:
- The enclosing document does not exist: DocumentDoesNotExistException
- The enclosing document is not JSON: DocumentNotJsonException
- No mutation was defined through the builder API: IllegalArgumentException
- A mutation spec couldn't be encoded and the whole operation was cancelled: TranscodingException
- The multi-mutation failed: MultiMutationException
- The durability constraint could not be fulfilled because of a temporary or persistent problem: DurabilityException
- CAS was provided but optimistic locking failed: CASMismatchException
When receiving a MultiMutationException
, one can inspect the exception to find the zero-based index and
error status code
of the first failing Mutation
. Subsequent mutations may have
also failed had they been attempted, but a single spec failing causes the whole operation to be cancelled.
Other top-level error conditions are similar to those encountered during a document-level Bucket.replace(Document)
.
A DurabilityException
typically happens if the given amount of replicas needed to fulfill the durability
requirement 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 execute has already happened, so the actual
execute and the watching for durability requirements are two separate tasks internally.**replicateTo
- the replication requirement to watch.timeout
- the specific timeout to apply for the operation.timeUnit
- the time unit for the timeout.DocumentFragment
(if successful) containing updated cas metadata. Note that some individual
results could also bear a value, like counter operations.public MutateInBuilder withExpiry(int expiry)
expiry
- the new expiry to apply (or 0 to avoid changing the expiry)public MutateInBuilder withCas(long cas)
cas
- the CAS to compare the enclosing document to.public MutateInBuilder withDurability(PersistTo persistTo)
persistTo
- the persistence durability constraint to observe.public MutateInBuilder withDurability(ReplicateTo replicateTo)
replicateTo
- the replication durability constraint to observe.public MutateInBuilder withDurability(PersistTo persistTo, ReplicateTo replicateTo)
persistTo
- the persistence durability constraint to observe.replicateTo
- the replication durability constraint to observe.@Deprecated public MutateInBuilder createDocument(boolean createDocument)
upsertDocument(boolean)
instead.createDocument
- true to create document.@InterfaceStability.Committed public MutateInBuilder upsertDocument(boolean upsertDocument)
upsertDocument
- true to create document.@InterfaceStability.Committed public MutateInBuilder insertDocument(boolean insertDocument)
insertDocument
- true to insert document.public <T> MutateInBuilder replace(String path, T fragment)
path
- the path where the value to replace is.fragment
- the new value.@Deprecated public <T> MutateInBuilder insert(String path, T fragment, boolean createPath)
path
- the path where to insert a new dictionary value.fragment
- the new dictionary value to insert.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder insert(String path, T fragment)
path
- the path where to insert a new dictionary value.fragment
- the new dictionary value to insert.public <T> MutateInBuilder insert(String path, T fragment, SubdocOptionsBuilder optionsBuilder)
path
- the path where to insert a new dictionary value.fragment
- the new dictionary value to insert.optionsBuilder
- SubdocOptionsBuilder
@Deprecated public <T> MutateInBuilder upsert(String path, T fragment, boolean createPath)
path
- the path where to insert (or replace) a dictionary value.fragment
- the new dictionary value to be applied.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder upsert(String path, T fragment)
path
- the path where to insert (or replace) a dictionary value.fragment
- the new dictionary value to be applied.@InterfaceStability.Committed public MutateInBuilder upsert(JsonObject content)
content
- full content of the JSON documentpublic <T> MutateInBuilder upsert(String path, T fragment, SubdocOptionsBuilder optionsBuilder)
path
- the path where to insert (or replace) a dictionary value.fragment
- the new dictionary value to be applied.optionsBuilder
- SubdocOptionsBuilder
public <T> MutateInBuilder remove(String path)
path
- the path to remove.public <T> MutateInBuilder remove(String path, SubdocOptionsBuilder optionsBuilder)
path
- the path to remove.optionsBuilder
- SubdocOptionsBuilder
@Deprecated public MutateInBuilder counter(String path, long delta, boolean createPath)
path
- the path to the counter (must be containing a number).delta
- the value to increment or decrement the counter by.createPath
- true to create missing intermediary nodes.public MutateInBuilder counter(String path, long delta)
path
- the path to the counter (must be containing a number).delta
- the value to increment or decrement the counter by.public MutateInBuilder counter(String path, long delta, SubdocOptionsBuilder optionsBuilder)
path
- the path to the counter (must be containing a number).delta
- the value to increment or decrement the counter by.optionsBuilder
- SubdocOptionsBuilder
@Deprecated public <T> MutateInBuilder arrayPrepend(String path, T value, boolean createPath)
path
- the path of the array.value
- the value to insert at the front of the array.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder arrayPrepend(String path, T value)
path
- the path of the array.value
- the value to insert at the front of the array.public <T> MutateInBuilder arrayPrepend(String path, T value, SubdocOptionsBuilder optionsBuilder)
path
- the path of the array.value
- the value to insert at the front of the array.optionsBuilder
- SubdocOptionsBuilder
@Deprecated public <T> MutateInBuilder arrayPrependAll(String path, Collection<T> values, boolean createPath)
arrayPrepend(String, Object, boolean)
(String, Object)} by grouping
mutations in a single packet.
For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ]
and not [ [ X, Y ], A, B, C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the collection of values to insert at the front of the array as individual elements.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder arrayPrependAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder)
arrayPrepend(String, Object, boolean)
(String, Object)} by grouping
mutations in a single packet.
For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ]
and not [ [ X, Y ], A, B, C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the collection of values to insert at the front of the array as individual elements.optionsBuilder
- SubdocOptionsBuilder
public <T> MutateInBuilder arrayPrependAll(String path, T... values)
arrayPrependAll(String, Collection, boolean)
.
Note that parent nodes are not created when using this method (ie. createPath = false).
First value becomes the first element of the array, second value the second, etc... All existing values
are shifted right in the array, by the number of inserted elements.
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual arrayPrepend(String, Object, boolean)
(String, Object)} by grouping
mutations in a single packet.
For example given an array [ A, B, C ], prepending the values X and Y yields [ X, Y, A, B, C ]
and not [ [ X, Y ], A, B, C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the values to insert at the front of the array as individual elements.if you need to create missing intermediary nodes.
@Deprecated public <T> MutateInBuilder arrayAppend(String path, T value, boolean createPath)
path
- the path of the array.value
- the value to insert at the back of the array.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder arrayAppend(String path, T value)
path
- the path of the array.value
- the value to insert at the back of the array.public <T> MutateInBuilder arrayAppend(String path, T value, SubdocOptionsBuilder optionsBuilder)
path
- the path of the array.value
- the value to insert at the back of the array.optionsBuilder
- SubdocOptionsBuilder
@Deprecated public <T> MutateInBuilder arrayAppendAll(String path, Collection<T> values, boolean createPath)
arrayAppend(String, Object, boolean)
by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the collection of values to individually insert at the back of the array.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder arrayAppendAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder)
arrayAppend(String, Object, boolean)
by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the collection of values to individually insert at the back of the array.optionsBuilder
- SubdocOptionsBuilder
public <T> MutateInBuilder arrayAppendAll(String path, T... values)
arrayAppendAll(String, Collection, boolean)
.
Note that parent nodes are not created when using this method (ie. createPath = false).
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual arrayAppend(String, Object, boolean)
by grouping mutations in
a single packet.
For example given an array [ A, B, C ], appending the values X and Y yields [ A, B, C, X, Y ]
and not [ A, B, C, [ X, Y ] ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the values to individually insert at the back of the array.if you need to create missing intermediary nodes.
public <T> MutateInBuilder arrayInsert(String path, T value)
path
- the path (including array position) where to insert the value.value
- the value to insert in the array.public <T> MutateInBuilder arrayInsert(String path, T value, SubdocOptionsBuilder optionsBuilder)
path
- the path (including array position) where to insert the value.value
- the value to insert in the array.optionsBuilder
- SubdocOptionsBuilder
public <T> MutateInBuilder arrayInsertAll(String path, Collection<T> values)
arrayInsert(String, Object)
by grouping mutations in a single packet.
For example given an array [ A, B, C ], inserting the values X and Y at position 1 yields [ A, B, X, Y, C ]
and not [ A, B, [ X, Y ], C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the values to insert at the specified position of the array, each value becoming an entry at or
after the insert position.public <T> MutateInBuilder arrayInsertAll(String path, Collection<T> values, SubdocOptionsBuilder optionsBuilder)
arrayInsert(String, Object)
by grouping mutations in a single packet.
For example given an array [ A, B, C ], inserting the values X and Y at position 1 yields [ A, B, X, Y, C ]
and not [ A, B, [ X, Y ], C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the values to insert at the specified position of the array, each value becoming an entry at or
after the insert position.optionsBuilder
- SubdocOptionsBuilder
public <T> MutateInBuilder arrayInsertAll(String path, T... values)
arrayInsertAll(String, Collection)
. Note that parent nodes are not created
when using this method (ie. createPath = false).
Each item in the collection is inserted as an individual element of the array, but a bit of overhead
is saved compared to individual arrayInsert(String, Object)
by grouping mutations in a single packet.
For example given an array [ A, B, C ], inserting the values X and Y at position 1 yields [ A, B, X, Y, C ]
and not [ A, B, [ X, Y ], C ].T
- the type of data in the collection (must be JSON serializable).path
- the path of the array.values
- the values to insert at the specified position of the array, each value becoming an entry at or
after the insert position.if you need to create missing intermediary nodes.
@Deprecated public <T> MutateInBuilder arrayAddUnique(String path, T value, boolean createPath)
path
- the path to mutate in the JSON.value
- the value to insert.createPath
- true to create missing intermediary nodes.public <T> MutateInBuilder arrayAddUnique(String path, T value)
path
- the path to mutate in the JSON.value
- the value to insert.public <T> MutateInBuilder arrayAddUnique(String path, T value, SubdocOptionsBuilder optionsBuilder)
path
- the path to mutate in the JSON.value
- the value to insert.optionsBuilder
- SubdocOptionsBuilder
Copyright © 2015 Couchbase, Inc.