Package com.arangodb

Interface ArangoCollection

All Superinterfaces:
ArangoSerdeAccessor
All Known Implementing Classes:
ArangoCollectionImpl

@ThreadSafe public interface ArangoCollection extends ArangoSerdeAccessor
Interface for operations on ArangoDB collection level.
Author:
Mark Vollmary, Heiko Kernbach, Michele Rastelli
See Also:
  • Method Details

    • 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:
    • 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:
    • 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:
    • insertDocuments

      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:
    • insertDocuments

      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:
    • 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:
    • insertDocuments

      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
      Returns:
      information about the documents
      See Also:
    • 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:
    • importDocuments

      DocumentImportEntity importDocuments(Iterable<?> values)
      Bulk imports the given values into the collection.
      Parameters:
      values - A List of documents (POJO or RawData)
      Returns:
      information about the import
      See Also:
    • importDocuments

      DocumentImportEntity importDocuments(Iterable<?> values, DocumentImportOptions options)
      Bulk imports the given values into the collection.
      Parameters:
      values - A List of documents (POJO or RawData)
      options - Additional options, can be null
      Returns:
      information about the import
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • replaceDocuments

      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:
    • replaceDocuments

      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:
    • 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:
    • replaceDocuments

      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
      Returns:
      information about the documents
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • updateDocuments

      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:
    • updateDocuments

      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:
    • 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:
    • updateDocuments

      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:
    • 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:
    • 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:
    • deleteDocument

      DocumentDeleteEntity<Void> deleteDocument(String key, DocumentDeleteOptions options)
      Deletes the document with the given key from the collection.
      Parameters:
      key - The key of the document
      options - Additional options
      Returns:
      information about the document
      See Also:
    • 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:
    • deleteDocuments

      Deletes multiple documents from the collection.
      Parameters:
      values - Raw data representing the keys of the documents or the documents themselves
      Returns:
      information about the documents
      See Also:
    • deleteDocuments

      Deletes multiple documents from the collection.
      Parameters:
      values - Raw data representing the keys of the documents or the documents themselves
      options - Additional options
      Returns:
      information about the documents
      See Also:
    • deleteDocuments

      MultiDocumentEntity<DocumentDeleteEntity<Void>> deleteDocuments(Iterable<?> values)
      Deletes multiple documents from the collection.
      Parameters:
      values - The keys of the documents or the documents themselves
      Returns:
      information about the documents
      See Also:
    • deleteDocuments

      Deletes multiple documents from the collection.
      Parameters:
      values - The keys of the documents or the documents themselves
      options - Additional options
      Returns:
      information about the documents
      See Also:
    • deleteDocuments

      <T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(Iterable<?> values, DocumentDeleteOptions options, Class<T> type)
      Deletes multiple documents from the collection.
      Parameters:
      values - The keys of the documents or the documents themselves
      type - Deserialization target type for the returned documents.
      options - Additional options
      Returns:
      information about the documents
      See Also:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • 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:
    • ensureZKDIndex

      @Deprecated IndexEntity ensureZKDIndex(Iterable<String> fields, ZKDIndexOptions options)
      Creates a ZKD multi-dimensional index for the collection, if it does not already exist. Note that zkd indexes are an experimental feature in ArangoDB 3.9.
      Parameters:
      fields - A list of attribute paths
      options - Additional options, can be null
      Returns:
      information about the index
      Since:
      ArangoDB 3.9
      See Also:
    • 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:
    • 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:
    • 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:
    • getIndexes

      Collection<IndexEntity> getIndexes()
      Fetches a list of all indexes on this collection.
      Note: inverted indexes are not returned by this method. Use getInvertedIndexes() instead.
      Returns:
      information about the indexes
      See Also:
    • getInvertedIndexes

      Collection<InvertedIndexEntity> getInvertedIndexes()
      Fetches a list of all inverted indexes on this collection.
      Returns:
      information about the indexes
      Since:
      ArangoDB 3.10
      See Also:
    • exists

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

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

      Removes all documents from the collection, but leaves the indexes intact
      Parameters:
      options -
      Returns:
      information about the collection
      Since:
      ArangoDB 3.5.0
      See Also:
    • count

      Counts the documents in a collection
      Returns:
      information about the collection, including the number of documents
      See Also:
    • count

      Counts the documents in a collection
      Parameters:
      options -
      Returns:
      information about the collection, including the number of documents
      Since:
      ArangoDB 3.5.0
      See Also:
    • create

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

      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:
    • drop

      void drop()
      Deletes the collection from the database.
      See Also:
    • 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:
    • getInfo

      CollectionEntity getInfo()
      Returns information about the collection
      Returns:
      information about the collection
      See Also:
    • getProperties

      Reads the properties of the specified collection
      Returns:
      properties of the collection
      See Also:
    • changeProperties

      Changes the properties of the collection
      Parameters:
      options - Additional options, can be null
      Returns:
      properties of the collection
      See Also:
    • rename

      CollectionEntity rename(String newName)
      Renames the collection
      Parameters:
      newName - The new name
      Returns:
      information about the collection
      See Also:
    • 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:
    • getRevision

      Retrieve the collections revision
      Returns:
      information about the collection, including the collections revision
      See Also:
    • 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:
    • 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:
    • 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:
    • 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: