Binary collection

class txcouchbase.binary_collection.BinaryCollection(impl: TxBinaryCollectionInterface)

The operations on a collection’s binary documents and counters.

Get one from binary().

append(key: str, value: str | bytes | bytearray, opts: AppendOptions | None = None, **kwargs: Unpack[AppendOptionsKwargs]) → Deferred[MutationResult]

Appends the specified value to the beginning of document of the specified key.

Parameters:
  • key (str) – The key of the document to append to.

  • value (str | bytes | bytearray) – The value to append to the document.

  • opts (AppendOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided AppendOptions

Returns:

An instance of MutationResult.

Return type:

Deferred[MutationResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

decrement(key: str, opts: DecrementOptions | None = None, **kwargs: Unpack[DecrementOptionsKwargs]) → Deferred[CounterResult]

Decrements the counter held in a document by the delta option, which defaults to 1.

Parameters:
  • key (str) – The key of the document to decrement.

  • opts (DecrementOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided DecrementOptions

Returns:

An instance of CounterResult.

Return type:

Deferred[CounterResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

increment(key: str, opts: IncrementOptions | None = None, **kwargs: Unpack[IncrementOptionsKwargs]) → Deferred[CounterResult]

Increments the counter held in a document by the delta option, which defaults to 1.

Parameters:
  • key (str) – The key of the document to increment.

  • opts (IncrementOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided IncrementOptions

Returns:

An instance of CounterResult.

Return type:

Deferred[CounterResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.

prepend(key: str, value: str | bytes | bytearray, opts: PrependOptions | None = None, **kwargs: Unpack[PrependOptionsKwargs]) → Deferred[MutationResult]

Prepends the specified value to the beginning of document of the specified key.

Parameters:
  • key (str) – The key of the document to prepend to.

  • value (str | bytes | bytearray) – The value to prepend to the document.

  • opts (PrependOptions) – Optional parameters for this operation.

  • **kwargs – keyword arguments that can be used in place or to override provided PrependOptions

Returns:

An instance of MutationResult.

Return type:

Deferred[MutationResult]

Raises:

DocumentNotFoundException – If the key provided does not exist on the server.