Package com.arangodb

Interface ArangoCollection

    • Method Detail

      • db

        ArangoDatabase db()
        The the handler of the database the collection is within
        Returns:
        database handler
      • name

        String name()
        The name of the collection
        Returns:
        collection name
      • insertDocument

        DocumentCreateEntity<Void> insertDocument​(Object value)
        Creates a new document from the given document, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        value - A representation of a single document (POJO or RawData
        Returns:
        information about the document
        See Also:
        API Documentation
      • insertDocument

        <T> DocumentCreateEntity<T> insertDocument​(T value,
                                                   DocumentCreateOptions options)
        Creates a new document from the given document, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        Returns:
        information about the document
        See Also:
        API Documentation
      • insertDocument

        <T> DocumentCreateEntity<T> insertDocument​(T value,
                                                   DocumentCreateOptions options,
                                                   Class<T> type)
        Creates a new document from the given document, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        type - Deserialization target type for the returned documents.
        Returns:
        information about the document
        See Also:
        API Documentation
      • insertDocuments

        MultiDocumentEntity<DocumentCreateEntity<Void>> insertDocuments​(RawData values)
        Creates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        values - Raw data representing a collection of documents
        Returns:
        information about the documents
        See Also:
        API Documentation
      • insertDocuments

        MultiDocumentEntity<DocumentCreateEntity<RawData>> insertDocuments​(RawData values,
                                                                           DocumentCreateOptions options)
        Creates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        values - Raw data representing a collection of documents
        options - Additional options
        Returns:
        information about the documents
        See Also:
        API Documentation
      • insertDocuments

        MultiDocumentEntity<DocumentCreateEntity<Void>> insertDocuments​(Iterable<?> values)
        Creates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        values - A List of documents
        Returns:
        information about the documents
        See Also:
        API Documentation
      • insertDocuments

        <T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments​(Iterable<? extends T> values,
                                                                         DocumentCreateOptions options,
                                                                         Class<T> type)
        Creates new documents from the given documents, unless there is already a document with the _key given. If no _key is given, a new unique _key is generated automatically.
        Parameters:
        values - A List of documents (POJO or RawData)
        options - Additional options
        type - Deserialization target type for the returned documents.
        Returns:
        information about the documents
        See Also:
        API Documentation
      • importDocuments

        DocumentImportEntity importDocuments​(RawData values)
        Bulk imports the given values into the collection.
        Parameters:
        values - Raw data representing a collection of documents
        Returns:
        information about the import
        See Also:
        API Documentation
      • importDocuments

        DocumentImportEntity importDocuments​(RawData values,
                                             DocumentImportOptions options)
        Bulk imports the given values into the collection.
        Parameters:
        values - Raw data representing a collection of documents
        options - Additional options, can be null
        Returns:
        information about the import
        See Also:
        API Documentation
      • getDocument

        <T> T getDocument​(String key,
                          Class<T> type)
        Retrieves the document with the given key from the collection.
        Parameters:
        key - The key of the document
        type - The type of the document (POJO or RawData)
        Returns:
        the document identified by the key
        See Also:
        API Documentation
      • getDocument

        <T> T getDocument​(String key,
                          Class<T> type,
                          DocumentReadOptions options)
        Retrieves the document with the given key from the collection.
        Parameters:
        key - The key of the document
        type - The type of the document (POJO or RawData)
        options - Additional options, can be null
        Returns:
        the document identified by the key
        See Also:
        API Documentation
      • getDocuments

        <T> MultiDocumentEntity<T> getDocuments​(Iterable<String> keys,
                                                Class<T> type)
        Retrieves multiple documents with the given _key from the collection.
        Parameters:
        keys - The keys of the documents
        type - The type of the documents (POJO or RawData)
        Returns:
        the documents and possible errors
        See Also:
        API Documentation
      • getDocuments

        <T> MultiDocumentEntity<T> getDocuments​(Iterable<String> keys,
                                                Class<T> type,
                                                DocumentReadOptions options)
        Retrieves multiple documents with the given _key from the collection.
        Parameters:
        keys - The keys of the documents
        type - The type of the documents (POJO or RawData)
        options - Additional options, can be null
        Returns:
        the documents and possible errors
        See Also:
        API Documentation
      • replaceDocument

        DocumentUpdateEntity<Void> replaceDocument​(String key,
                                                   Object value)
        Replaces the document with key with the one in the body, provided there is such a document and no precondition is violated
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        Returns:
        information about the document
        See Also:
        API Documentation
      • replaceDocument

        <T> DocumentUpdateEntity<T> replaceDocument​(String key,
                                                    T value,
                                                    DocumentReplaceOptions options)
        Replaces the document with key with the one in the body, provided there is such a document and no precondition is violated
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        Returns:
        information about the document
        See Also:
        API Documentation
      • replaceDocument

        <T> DocumentUpdateEntity<T> replaceDocument​(String key,
                                                    T value,
                                                    DocumentReplaceOptions options,
                                                    Class<T> type)
        Replaces the document with key with the one in the body, provided there is such a document and no precondition is violated
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        type - Deserialization target type for the returned documents.
        Returns:
        information about the document
        See Also:
        API Documentation
      • replaceDocuments

        MultiDocumentEntity<DocumentUpdateEntity<Void>> replaceDocuments​(RawData values)
        Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.
        Parameters:
        values - Raw data representing a collection of documents
        Returns:
        information about the documents
        See Also:
        API Documentation
      • replaceDocuments

        MultiDocumentEntity<DocumentUpdateEntity<RawData>> replaceDocuments​(RawData values,
                                                                            DocumentReplaceOptions options)
        Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.
        Parameters:
        values - Raw data representing a collection of documents
        options - Additional options
        Returns:
        information about the documents
        See Also:
        API Documentation
      • replaceDocuments

        MultiDocumentEntity<DocumentUpdateEntity<Void>> replaceDocuments​(Iterable<?> values)
        Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.
        Parameters:
        values - A List of documents (POJO or RawData)
        Returns:
        information about the documents
        See Also:
        API Documentation
      • replaceDocuments

        <T> MultiDocumentEntity<DocumentUpdateEntity<T>> replaceDocuments​(Iterable<? extends T> values,
                                                                          DocumentReplaceOptions options,
                                                                          Class<T> type)
        Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are specified by the _key attributes in the documents in values.
        Parameters:
        values - A List of documents (POJO or RawData)
        options - Additional options
        type - Deserialization target type for the returned documents.
        Returns:
        information about the documents
        See Also:
        API Documentation
      • updateDocument

        DocumentUpdateEntity<Void> updateDocument​(String key,
                                                  Object value)
        Partially updates the document identified by document-key. The value must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        Returns:
        information about the document
        See Also:
        API Documentation
      • updateDocument

        <T> DocumentUpdateEntity<T> updateDocument​(String key,
                                                   T value,
                                                   DocumentUpdateOptions options)
        Partially updates the document identified by document-key. The value must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        Returns:
        information about the document
        See Also:
        API Documentation
      • updateDocument

        <T> DocumentUpdateEntity<T> updateDocument​(String key,
                                                   Object value,
                                                   DocumentUpdateOptions options,
                                                   Class<T> returnType)
        Partially updates the document identified by document-key. The value must contain a document with the attributes to patch (the patch document). All attributes from the patch document will be added to the existing document if they do not yet exist, and overwritten in the existing document if they do exist there.
        Parameters:
        key - The key of the document
        value - A representation of a single document (POJO or RawData)
        options - Additional options
        returnType - Type of the returned newDocument and/or oldDocument
        Returns:
        information about the document
        See Also:
        API Documentation
      • updateDocuments

        MultiDocumentEntity<DocumentUpdateEntity<Void>> updateDocuments​(RawData values)
        Partially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.
        Parameters:
        values - Raw data representing a collection of documents
        Returns:
        information about the documents
        See Also:
        API Documentation
      • updateDocuments

        MultiDocumentEntity<DocumentUpdateEntity<RawData>> updateDocuments​(RawData values,
                                                                           DocumentUpdateOptions options)
        Partially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.
        Parameters:
        values - Raw data representing a collection of documents
        options - Additional options
        Returns:
        information about the documents
        See Also:
        API Documentation
      • updateDocuments

        MultiDocumentEntity<DocumentUpdateEntity<Void>> updateDocuments​(Iterable<?> values)
        Partially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.
        Parameters:
        values - A list of documents (POJO or RawData)
        Returns:
        information about the documents
        See Also:
        API Documentation
      • updateDocuments

        MultiDocumentEntity<DocumentUpdateEntity<Void>> updateDocuments​(Iterable<?> values,
                                                                        DocumentUpdateOptions options)
        Partially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.
        Parameters:
        values - A list of documents (POJO or RawData)
        options - Additional options
        Returns:
        information about the documents
        See Also:
        API Documentation
      • updateDocuments

        <T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments​(Iterable<?> values,
                                                                         DocumentUpdateOptions options,
                                                                         Class<T> returnType)
        Partially updates documents, the documents to update are specified by the _key attributes in the objects on values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All attributes from the patch documents will be added to the existing documents if they do not yet exist, and overwritten in the existing documents if they do exist there.
        Parameters:
        values - A list of documents (POJO or RawData)
        options - Additional options
        returnType - Type of the returned newDocument and/or oldDocument
        Returns:
        information about the documents
        See Also:
        API Documentation
      • deleteDocument

        DocumentDeleteEntity<Void> deleteDocument​(String key)
        Deletes the document with the given key from the collection.
        Parameters:
        key - The key of the document
        Returns:
        information about the document
        See Also:
        API Documentation
      • deleteDocument

        <T> DocumentDeleteEntity<T> deleteDocument​(String key,
                                                   DocumentDeleteOptions options,
                                                   Class<T> type)
        Deletes the document with the given key from the collection.
        Parameters:
        key - The key of the document
        type - Deserialization target type for the returned documents.
        options - Additional options
        Returns:
        information about the document
        See Also:
        API Documentation
      • documentExists

        Boolean documentExists​(String key)
        Checks if the document exists by reading a single document head
        Parameters:
        key - The key of the document
        Returns:
        true if the document was found, otherwise false
        See Also:
        API Documentation
      • documentExists

        Boolean documentExists​(String key,
                               DocumentExistsOptions options)
        Checks if the document exists by reading a single document head
        Parameters:
        key - The key of the document
        options - Additional options, can be null
        Returns:
        true if the document was found, otherwise false
        See Also:
        API Documentation
      • getIndex

        IndexEntity getIndex​(String id)
        Fetches information about the index with the given id and returns it.
        Note: inverted indexes are not returned by this method. Use getInvertedIndex(String) instead.
        Parameters:
        id - The index-handle
        Returns:
        information about the index
        See Also:
        API Documentation
      • getInvertedIndex

        InvertedIndexEntity getInvertedIndex​(String id)
        Fetches information about the inverted index with the given id and returns it.
        Parameters:
        id - The index-handle
        Returns:
        information about the index
        Since:
        ArangoDB 3.10
        See Also:
        API Documentation
      • deleteIndex

        String deleteIndex​(String id)
        Deletes the index with the given id from the collection.
        Parameters:
        id - The index-handle
        Returns:
        the id of the index
        See Also:
        API Documentation
      • ensurePersistentIndex

        IndexEntity ensurePersistentIndex​(Iterable<String> fields,
                                          PersistentIndexOptions options)
        Creates a persistent index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute paths
        options - Additional options, can be null
        Returns:
        information about the index
        See Also:
        API Documentation
      • ensureGeoIndex

        IndexEntity ensureGeoIndex​(Iterable<String> fields,
                                   GeoIndexOptions options)
        Creates a geo-spatial index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute paths
        options - Additional options, can be null
        Returns:
        information about the index
        See Also:
        API Documentation
      • ensureFulltextIndex

        @Deprecated
        IndexEntity ensureFulltextIndex​(Iterable<String> fields,
                                        FulltextIndexOptions options)
        Deprecated.
        since ArangoDB 3.10, use ArangoSearch or Inverted indexes instead.
        Creates a fulltext index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute paths
        options - Additional options, can be null
        Returns:
        information about the index
        See Also:
        API Documentation
      • ensureTtlIndex

        IndexEntity ensureTtlIndex​(Iterable<String> fields,
                                   TtlIndexOptions options)
        Creates a ttl index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute paths
        options - Additional options, can be null
        Returns:
        information about the index
        See Also:
        API Documentation
      • ensureMDIndex

        IndexEntity ensureMDIndex​(Iterable<String> fields,
                                  MDIndexOptions options)
        Creates a multi-dimensional index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute names used for each dimension
        options - Additional options, can be null.
        Returns:
        information about the index
        Since:
        ArangoDB 3.12
        See Also:
        API Documentation
      • ensureMDPrefixedIndex

        IndexEntity ensureMDPrefixedIndex​(Iterable<String> fields,
                                          MDPrefixedIndexOptions options)
        Creates a multi-dimensional prefixed index for the collection, if it does not already exist.
        Parameters:
        fields - A list of attribute names used for each dimension
        options - Additional options, cannot be null.
        Returns:
        information about the index
        Since:
        ArangoDB 3.12
        See Also:
        API Documentation
      • ensureInvertedIndex

        InvertedIndexEntity ensureInvertedIndex​(InvertedIndexOptions options)
        Creates an inverted index for the collection, if it does not already exist.
        Parameters:
        options - index creation options
        Returns:
        information about the index
        Since:
        ArangoDB 3.10
        See Also:
        API Documentation
      • exists

        boolean exists()
        Checks whether the collection exists
        Returns:
        true if the collection exists, otherwise false
        See Also:
        API Documentation
      • truncate

        CollectionEntity truncate()
        Removes all documents from the collection, but leaves the indexes intact
        Returns:
        information about the collection
        See Also:
        API Documentation
      • create

        CollectionEntity create()
        Creates a collection for this collection's name, then returns collection information from the server.
        Returns:
        information about the collection
        See Also:
        API Documentation
      • create

        CollectionEntity create​(CollectionCreateOptions options)
        Creates a collection with the given options for this collection's name, then returns collection information from the server.
        Parameters:
        options - Additional options, can be null
        Returns:
        information about the collection
        See Also:
        API Documentation
      • drop

        void drop()
        Deletes the collection from the database.
        See Also:
        API Documentation
      • drop

        void drop​(boolean isSystem)
        Deletes the collection from the database.
        Parameters:
        isSystem - Whether or not the collection to drop is a system collection. This parameter must be set to true in order to drop a system collection.
        Since:
        ArangoDB 3.1.0
        See Also:
        API Documentation
      • getResponsibleShard

        ShardEntity getResponsibleShard​(Object value)
        Returns the responsible shard for the document. Please note that this API is only meaningful and available on a cluster coordinator.
        Parameters:
        value - A projection of the document containing at least the shard key (_key or a custom attribute) for which the responsible shard should be determined
        Returns:
        information about the responsible shard
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • grantAccess

        void grantAccess​(String user,
                         Permissions permissions)
        Grants or revoke access to the collection for user user. You need permission to the _system database in order to execute this call.
        Parameters:
        user - The name of the user
        permissions - The permissions the user grant
        See Also:
        API Documentation
      • revokeAccess

        void revokeAccess​(String user)
        Revokes access to the collection for user user. You need permission to the _system database in order to execute this call.
        Parameters:
        user - The name of the user
        See Also:
        API Documentation
      • resetAccess

        void resetAccess​(String user)
        Clear the collection access level, revert back to the default access level.
        Parameters:
        user - The name of the user
        Since:
        ArangoDB 3.2.0
        See Also:
        API Documentation
      • getPermissions

        Permissions getPermissions​(String user)
        Get the collection access level
        Parameters:
        user - The name of the user
        Returns:
        permissions of the user
        Since:
        ArangoDB 3.2.0
        See Also:
        API Documentation