Package oracle.soda

Interface OracleCollection


  • public interface OracleCollection
    A collection of documents.
    • Method Detail

      • find

        OracleOperationBuilder find()
        Returns an OracleOperationBuilder representing an operation that finds all documents in the collection.
        Returns:
        OracleOperationBuilder
      • findOne

        OracleDocument findOne​(String key)
                        throws OracleException
        Finds an OracleDocument matching a key.

        This is a convenience method. The same operation can be expressed as: col.find().key("k1").getOne()

        Parameters:
        key - the key. Cannot be null
        Returns:
        OracleDocument matching the key. null if not found.
        Throws:
        OracleException - if the key is null
      • insert

        void insert​(OracleDocument document)
             throws OracleException
        Inserts a document into the collection.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are client-assigned for this collection, and the key provided in the input document already exists in the collection, or (4) keys are auto-generated for this collection, and the key is provided in the input document, or (5) an error during insertion occurs
      • insertAndGet

        OracleDocument insertAndGet​(OracleDocument document)
                             throws OracleException
        Inserts a document into the collection.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        Returns:
        result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are client-assigned for this collection, and the key provided in the input document already exists in the collection, or (4) keys are auto-generated for this collection, and the key is provided in the input document, or (5) an error during insertion occurs
      • insertAndGet

        OracleDocument insertAndGet​(OracleDocument document,
                                    Map<String,​?> options)
                             throws OracleException
        Inserts a document into the collection.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        options - null or a Map of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. "hint" is a valid key with string value containing one or more insert hints.
        Returns:
        result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are client-assigned for this collection, and the key provided in the input document already exists in the collection, or (4) keys are auto-generated for this collection, and the key is provided in the input document, or (5) an error during insertion occurs or (6) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
      • save

        void save​(OracleDocument document)
           throws OracleException
        Saves a document into the collection. This method is equivalent to insert(OracleDocument) except that if client-assigned keys are used, and the document with the specified key already exists in the collection, it will be replaced with the input document.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are auto-generated for this collection, and the key is provided in the input document, or (4) an error during insertion occurs
      • saveAndGet

        OracleDocument saveAndGet​(OracleDocument document)
                           throws OracleException
        Saves a document into the collection. This method is equivalent to insertAndGet(OracleDocument) except that if client-assigned keys are used, and the document with the specified key already exists in the collection, it will be replaced with the input document.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        Returns:
        result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are auto-generated for this collection, and the key is provided in the input document, or (4) an error during insertion occurs
      • saveAndGet

        OracleDocument saveAndGet​(OracleDocument document,
                                  Map<String,​?> options)
                           throws OracleException
        Saves a document into the collection. This method is equivalent to insertAndGet(OracleDocument) except that if client-assigned keys are used, and the document with the specified key already exists in the collection, it will be replaced with the input document.

        The key will be automatically created, unless this collection is configured with client-assigned keys and the key is provided in the input document.

        Parameters:
        document - input document. Cannot have a key if the collection is configured to auto-generate keys. Cannot be null
        options - null or a Map of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. "hint" is a valid key with string value containing one or more save hints.
        Returns:
        result document which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input document's content is not returned as part of the result document.
        Throws:
        OracleException - if (1) the input document is null, or (2) keys are client-assigned for this collection, but the key is not provided in the input document, or (3) keys are auto-generated for this collection, and the key is provided in the input document, or (4) an error during insertion occurs or (5) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
      • insert

        void insert​(Iterator<OracleDocument> documents)
             throws OracleBatchException
        Inserts multiple documents into the collection.

        The keys will be automatically created, unless this collection has client-assigned keys and the key is provided in the input document.

        If there is an error inserting one of the documents, OracleBatchException will be thrown. Invoking OracleBatchException.getProcessed() method returns the number of document processed successfully before the error occurred.

        Parameters:
        documents - an Iterator over input documents. Cannot be null. Documents cannot have keys if the collection is configured to auto-generate keys.
        Throws:
        OracleBatchException - if (1) the input documents Iterator is null, or (2) keys are client-assigned for this collection, but the key is not provided for one or more of the input documents, or (3) keys are client-assigned for this collection, and the key provided for one or more of the input documents already exists in the collection, or (4) keys are auto-generated for this collection, but the key is provided in one or more input documents, or (5) if an error during insertion occurs
      • insertAndGet

        List<OracleDocument> insertAndGet​(Iterator<OracleDocument> documents)
                                   throws OracleBatchException
        Inserts multiple documents into the collection.

        The keys will be automatically created, unless this collection has client-assigned keys and the key is provided in the input document.

        If there is an error inserting one of the documents, OracleBatchException will be thrown. Invoking OracleBatchException.getProcessedCount() method returns the number of document processed successfully before the error occurred.

        Parameters:
        documents - an iterator over input documents. Cannot be null. Documents cannot have keys if the collection is configured to auto-generate keys
        Returns:
        an list of result documents, each of which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input documents' contents are not returned as part of the result documents.
        Throws:
        OracleBatchException - if (1) the input documents Iterator is null, or (2) keys are client-assigned for this collection, but the key is not provided for one or more of the input documents, or (3) keys are client-assigned for this collection, and the key provided for one or more of the input documents already exists in the collection, or (4) keys are auto-generated for this collection, but the key is provided in one or more input documents, or (5) if an error during insertion occurs
      • insertAndGet

        List<OracleDocument> insertAndGet​(Iterator<OracleDocument> documents,
                                          Map<String,​?> options)
                                   throws OracleBatchException
        Inserts multiple documents into the collection with options.

        The keys will be automatically created, unless this collection has client-assigned keys and the key is provided in the input document.

        If there is an error inserting one of the documents, OracleBatchException will be thrown. Invoking OracleBatchException.getProcessedCount() method returns the number of document processed successfully before the error occurred.

        Parameters:
        documents - an iterator over input documents. Cannot be null. Documents cannot have keys if the collection is configured to auto-generate keys
        options - null or a Map of options. The key is option name and the value is the option value. The semantics of the options are implementation defined. Valid hints are:

        "hint" with string value containing one or more insert hints.

        "maxBatchSize" with Integer value representing the desired batch size.

        Returns:
        an list of result documents, each of which contains the key and (if present) the created-on timestamp, last-modified timestamp, and version only. The input documents' contents are not returned as part of the result documents.
        Throws:
        OracleBatchException - if (1) the input documents Iterator is null, or (2) keys are client-assigned for this collection, but the key is not provided for one or more of the input documents, or (3) keys are client-assigned for this collection, and the key provided for one or more of the input documents already exists in the collection, or (4) keys are auto-generated for this collection, but the key is provided in one or more input documents, or (5) if an error during insertion occurs or (6) the value of the hint supplied through options is not of string type or contains substring "/*" or "\*\/"
      • admin

        OracleCollectionAdmin admin()
        Gets an OracleCollectionAdmin object
        Returns:
        a OracleCollectionAdmin object