Class BinaryCollection


  • public class BinaryCollection
    extends Object
    Allows to perform certain operations on non-JSON documents.
    • Method Detail

      • append

        public MutationResult append​(String id,
                                     byte[] content)
        Appends binary content to the document.
        Parameters:
        id - the document id which is used to uniquely identify it.
        content - the binary content to append to the document.
        Returns:
        a MutationResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        CasMismatchException - if the document has been concurrently modified on the server.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • append

        public MutationResult append​(String id,
                                     byte[] content,
                                     AppendOptions options)
        Appends binary content to the document with custom options.
        Parameters:
        id - the document id which is used to uniquely identify it.
        content - the binary content to append to the document.
        options - custom options to customize the append behavior.
        Returns:
        a MutationResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        CasMismatchException - if the document has been concurrently modified on the server.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • prepend

        public MutationResult prepend​(String id,
                                      byte[] content)
        Prepends binary content to the document.
        Parameters:
        id - the document id which is used to uniquely identify it.
        content - the binary content to append to the document.
        Returns:
        a MutationResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        CasMismatchException - if the document has been concurrently modified on the server.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • prepend

        public MutationResult prepend​(String id,
                                      byte[] content,
                                      PrependOptions options)
        Prepends binary content to the document with custom options.
        Parameters:
        id - the document id which is used to uniquely identify it.
        content - the binary content to append to the document.
        options - custom options to customize the prepend behavior.
        Returns:
        a MutationResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        CasMismatchException - if the document has been concurrently modified on the server.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • increment

        public CounterResult increment​(String id)
        Increments the counter document by one.
        Parameters:
        id - the document id which is used to uniquely identify it.
        Returns:
        a CounterResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • increment

        public CounterResult increment​(String id,
                                       IncrementOptions options)
        Increments the counter document by one or the number defined in the options.
        Parameters:
        id - the document id which is used to uniquely identify it.
        options - custom options to customize the increment behavior.
        Returns:
        a CounterResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • decrement

        public CounterResult decrement​(String id)
        Decrements the counter document by one.
        Parameters:
        id - the document id which is used to uniquely identify it.
        Returns:
        a CounterResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).
      • decrement

        public CounterResult decrement​(String id,
                                       DecrementOptions options)
        Decrements the counter document by one or the number defined in the options.
        Parameters:
        id - the document id which is used to uniquely identify it.
        options - custom options to customize the decrement behavior.
        Returns:
        a CounterResult once completed.
        Throws:
        DocumentNotFoundException - the given document id is not found in the collection.
        TimeoutException - if the operation times out before getting a result.
        CouchbaseException - for all other error reasons (acts as a base type and catch-all).