Package com.c8db
Interface C8Collection
-
- All Superinterfaces:
C8SerializationAccessor
- All Known Implementing Classes:
C8CollectionImpl
public interface C8Collection extends C8SerializationAccessor
Interface for operations on C8DB collection level.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CollectionPropertiesEntitychangeProperties(CollectionPropertiesOptions options)Changes the properties of the collectionCollectionPropertiesEntitycount()Counts the documents in a collectionCollectionPropertiesEntitycount(CollectionCountOptions options)Counts the documents in a collectionCollectionEntitycreate()Creates a collection for this collection's name, then returns collection information from the server.CollectionEntitycreate(CollectionCreateOptions options)Creates a collection with the givenoptionsfor this collection's name, then returns collection information from the server.C8Databasedb()The the handler of the database the collection is withinDocumentDeleteEntity<Void>deleteDocument(String key)Deletes the document with the givenkeyfrom the collection.<T> DocumentDeleteEntity<T>deleteDocument(String key, Class<T> type, DocumentDeleteOptions options)Deletes the document with the givenkeyfrom the collection.MultiDocumentEntity<DocumentDeleteEntity<Void>>deleteDocuments(Collection<?> values)Deletes multiple documents from the collection.<T> MultiDocumentEntity<DocumentDeleteEntity<T>>deleteDocuments(Collection<?> values, Class<T> type, DocumentDeleteOptions options)Deletes multiple documents from the collection.StringdeleteIndex(String id)Deletes the index with the givenidfrom the collection.BooleandocumentExists(String key)Checks if the document exists by reading a single document headBooleandocumentExists(String key, DocumentExistsOptions options)Checks if the document exists by reading a single document headvoiddrop()Deletes the collection from the database.voiddrop(boolean isSystem)Deletes the collection from the database.IndexEntityensureFulltextIndex(Iterable<String> fields, FulltextIndexOptions options)Creates a fulltext index for the collection, if it does not already exist.IndexEntityensureGeoIndex(Iterable<String> fields, GeoIndexOptions options)Creates a geo-spatial index for the collection, if it does not already exist.IndexEntityensureHashIndex(Iterable<String> fields, HashIndexOptions options)Creates a hash index for the collection if it does not already exist.IndexEntityensurePersistentIndex(Iterable<String> fields, PersistentIndexOptions options)Creates a persistent index for the collection, if it does not already exist.IndexEntityensureSkiplistIndex(Iterable<String> fields, SkiplistIndexOptions options)Creates a skip-list index for the collection, if it does not already exist.IndexEntityensureTTLIndex(Iterable<String> fields, TTLIndexOptions options)Creates a ttl index for the collection, if it does not already exist.booleanexists()Checks whether the collection exists<T> TgetDocument(String key, Class<T> type)Retrieves the document with the givenkeyfrom the collection.<T> TgetDocument(String key, Class<T> type, DocumentReadOptions options)Retrieves the document with the givenkeyfrom the collection.<T> MultiDocumentEntity<T>getDocuments(Collection<String> keys, Class<T> type)Retrieves multiple documents with the given_keyfrom the collection.<T> MultiDocumentEntity<T>getDocuments(Collection<String> keys, Class<T> type, DocumentReadOptions options)Retrieves multiple documents with the given_keyfrom the collection.IndexEntitygetIndex(String id)Fetches information about the index with the givenidand returns it.Collection<IndexEntity>getIndexes()Fetches a list of all indexes on this collection.CollectionEntitygetInfo()Returns information about the collectionPermissionsgetPermissions(String user)Get the collection access levelCollectionPropertiesEntitygetProperties()Reads the properties of the specified collectionvoidgrantAccess(String user, Permissions permissions)Grants or revoke access to the collection for user user.<T> DocumentCreateEntity<T>insertDocument(T value)Creates a new document from the given document, unless there is already a document with the _key given.<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.<T> MultiDocumentEntity<DocumentCreateEntity<T>>insertDocuments(Collection<T> values)Creates new documents from the given documents, unless there is already a document with the _key given.<T> MultiDocumentEntity<DocumentCreateEntity<T>>insertDocuments(Collection<T> values, DocumentCreateOptions options)Creates new documents from the given documents, unless there is already a document with the _key given.Stringname()The name of the collectionCollectionEntityrename(String newName)Renames the collection<T> DocumentUpdateEntity<T>replaceDocument(String key, T value)Replaces the document withkeywith the one in the body, provided there is such a document and no precondition is violated<T> DocumentUpdateEntity<T>replaceDocument(String key, T value, DocumentReplaceOptions options)Replaces the document withkeywith the one in the body, provided there is such a document and no precondition is violated<T> MultiDocumentEntity<DocumentUpdateEntity<T>>replaceDocuments(Collection<T> 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.<T> MultiDocumentEntity<DocumentUpdateEntity<T>>replaceDocuments(Collection<T> 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.voidresetAccess(String user)Clear the collection access level, revert back to the default access level.voidrevokeAccess(String user)Revokes access to the collection for user user.CollectionEntitytruncate()Removes all documents from the collection, but leaves the indexes intactCollectionEntitytruncate(CollectionTruncateOptions options)Removes all documents from the collection, but leaves the indexes intact<T> DocumentUpdateEntity<T>updateDocument(String key, T value)Partially updates the document identified by document-key.<T> DocumentUpdateEntity<T>updateDocument(String key, T value, DocumentUpdateOptions options)Partially updates the document identified by document-key.<T> MultiDocumentEntity<DocumentUpdateEntity<T>>updateDocuments(Collection<T> values)Partially updates documents, the documents to update are specified by the _key attributes in the objects on values.<T> MultiDocumentEntity<DocumentUpdateEntity<T>>updateDocuments(Collection<T> values, DocumentUpdateOptions options)Partially updates documents, the documents to update are specified by the _key attributes in the objects on values.-
Methods inherited from interface com.c8db.C8SerializationAccessor
util, util
-
-
-
-
Method Detail
-
db
C8Database 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
<T> DocumentCreateEntity<T> insertDocument(T value) throws C8DBException
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, VPackSlice or String for JSON)- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
insertDocument
<T> DocumentCreateEntity<T> insertDocument(T value, DocumentCreateOptions options) throws C8DBException
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, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
insertDocuments
<T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(Collection<T> values) throws C8DBException
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, VPackSlice or String for JSON)- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
insertDocuments
<T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(Collection<T> values, DocumentCreateOptions options) throws C8DBException
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, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String key, Class<T> type) throws C8DBException
Retrieves the document with the givenkeyfrom the collection.- Parameters:
key- The key of the documenttype- The type of the document (POJO class, VPackSlice or String for JSON)- Returns:
- the document identified by the key
- Throws:
C8DBException- See Also:
- API Documentation
-
getDocument
<T> T getDocument(String key, Class<T> type, DocumentReadOptions options) throws C8DBException
Retrieves the document with the givenkeyfrom the collection.- Parameters:
key- The key of the documenttype- The type of the document (POJO class, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- the document identified by the key
- Throws:
C8DBException- See Also:
- API Documentation
-
getDocuments
<T> MultiDocumentEntity<T> getDocuments(Collection<String> keys, Class<T> type) throws C8DBException
Retrieves multiple documents with the given_keyfrom the collection.- Parameters:
keys- The keys of the documentstype- The type of the documents (POJO class, VPackSlice or String for JSON)- Returns:
- the documents and possible errors
- Throws:
C8DBException
-
getDocuments
<T> MultiDocumentEntity<T> getDocuments(Collection<String> keys, Class<T> type, DocumentReadOptions options) throws C8DBException
Retrieves multiple documents with the given_keyfrom the collection.- Parameters:
keys- The keys of the documentstype- The type of the documents (POJO class, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- the documents and possible errors
- Throws:
C8DBException
-
replaceDocument
<T> DocumentUpdateEntity<T> replaceDocument(String key, T value) throws C8DBException
Replaces the document withkeywith the one in the body, provided there is such a document and no precondition is violated- Parameters:
key- The key of the documentvalue- A representation of a single document (POJO, VPackSlice or String for JSON)- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
replaceDocument
<T> DocumentUpdateEntity<T> replaceDocument(String key, T value, DocumentReplaceOptions options) throws C8DBException
Replaces the document withkeywith the one in the body, provided there is such a document and no precondition is violated- Parameters:
key- The key of the documentvalue- A representation of a single document (POJO, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
replaceDocuments
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> replaceDocuments(Collection<T> values) throws C8DBException
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, VPackSlice or String for JSON)- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
replaceDocuments
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> replaceDocuments(Collection<T> values, DocumentReplaceOptions options) throws C8DBException
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, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
updateDocument
<T> DocumentUpdateEntity<T> updateDocument(String key, T value) throws C8DBException
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 documentvalue- A representation of a single document (POJO, VPackSlice or String for JSON)- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
updateDocument
<T> DocumentUpdateEntity<T> updateDocument(String key, T value, DocumentUpdateOptions options) throws C8DBException
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 documentvalue- A representation of a single document (POJO, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
updateDocuments
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments(Collection<T> values) throws C8DBException
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, VPackSlice or String for JSON)- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
updateDocuments
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments(Collection<T> values, DocumentUpdateOptions options) throws C8DBException
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, VPackSlice or String for JSON)options- Additional options, can be null- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteDocument
DocumentDeleteEntity<Void> deleteDocument(String key) throws C8DBException
Deletes the document with the givenkeyfrom the collection.- Parameters:
key- The key of the document- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteDocument
<T> DocumentDeleteEntity<T> deleteDocument(String key, Class<T> type, DocumentDeleteOptions options) throws C8DBException
Deletes the document with the givenkeyfrom the collection.- Parameters:
key- The key of the documenttype- The type of the document (POJO class, VPackSlice or String for JSON). Only necessary if options.returnOld is set to true, otherwise can be null.options- Additional options, can be null- Returns:
- information about the document
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteDocuments
MultiDocumentEntity<DocumentDeleteEntity<Void>> deleteDocuments(Collection<?> values) throws C8DBException
Deletes multiple documents from the collection.- Parameters:
values- The keys of the documents or the documents themselves- Returns:
- information about the documents
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteDocuments
<T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(Collection<?> values, Class<T> type, DocumentDeleteOptions options) throws C8DBException
Deletes multiple documents from the collection.- Parameters:
values- The keys of the documents or the documents themselvestype- The type of the documents (POJO class, VPackSlice or String for JSON). Only necessary if options.returnOld is set to true, otherwise can be null.options- Additional options, can be null- Returns:
- information about the documents
- Throws:
C8DBException- 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) throws C8DBException
Checks if the document exists by reading a single document head- Parameters:
key- The key of the documentoptions- Additional options, can be null- Returns:
- true if the document was found, otherwise false
- Throws:
C8DBException- only thrown whenDocumentExistsOptions.isCatchException()== false- See Also:
- API Documentation
-
getIndex
IndexEntity getIndex(String id) throws C8DBException
Fetches information about the index with the givenidand returns it.- Parameters:
id- The index-handle- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
deleteIndex
String deleteIndex(String id) throws C8DBException
Deletes the index with the givenidfrom the collection.- Parameters:
id- The index-handle- Returns:
- the id of the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensureHashIndex
IndexEntity ensureHashIndex(Iterable<String> fields, HashIndexOptions options) throws C8DBException
Creates a hash index for the collection if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensureSkiplistIndex
IndexEntity ensureSkiplistIndex(Iterable<String> fields, SkiplistIndexOptions options) throws C8DBException
Creates a skip-list index for the collection, if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensurePersistentIndex
IndexEntity ensurePersistentIndex(Iterable<String> fields, PersistentIndexOptions options) throws C8DBException
Creates a persistent index for the collection, if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensureGeoIndex
IndexEntity ensureGeoIndex(Iterable<String> fields, GeoIndexOptions options) throws C8DBException
Creates a geo-spatial index for the collection, if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensureFulltextIndex
IndexEntity ensureFulltextIndex(Iterable<String> fields, FulltextIndexOptions options) throws C8DBException
Creates a fulltext index for the collection, if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException- See Also:
- API Documentation
-
ensureTTLIndex
IndexEntity ensureTTLIndex(Iterable<String> fields, TTLIndexOptions options) throws C8DBException
Creates a ttl index for the collection, if it does not already exist.- Parameters:
fields- A list of attribute pathsoptions- Additional options, can be null- Returns:
- information about the index
- Throws:
C8DBException
-
getIndexes
Collection<IndexEntity> getIndexes() throws C8DBException
Fetches a list of all indexes on this collection.- Returns:
- information about the indexes
- Throws:
C8DBException- See Also:
- API Documentation
-
exists
boolean exists() throws C8DBExceptionChecks whether the collection exists- Returns:
- true if the collection exists, otherwise false
- Throws:
C8DBException
-
truncate
CollectionEntity truncate() throws C8DBException
Removes all documents from the collection, but leaves the indexes intact- Returns:
- information about the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
truncate
CollectionEntity truncate(CollectionTruncateOptions options) throws C8DBException
Removes all documents from the collection, but leaves the indexes intact- Parameters:
options-- Returns:
- information about the collection
- Throws:
C8DBException- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
count
CollectionPropertiesEntity count() throws C8DBException
Counts the documents in a collection- Returns:
- information about the collection, including the number of documents
- Throws:
C8DBException- See Also:
- API Documentation
-
count
CollectionPropertiesEntity count(CollectionCountOptions options) throws C8DBException
Counts the documents in a collection- Parameters:
options-- Returns:
- information about the collection, including the number of documents
- Throws:
C8DBException- Since:
- ArangoDB 3.5.0
- See Also:
- API Documentation
-
create
CollectionEntity create() throws C8DBException
Creates a collection for this collection's name, then returns collection information from the server.- Returns:
- information about the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
create
CollectionEntity create(CollectionCreateOptions options) throws C8DBException
Creates a collection with the givenoptionsfor this collection's name, then returns collection information from the server.- Parameters:
options- Additional options, can be null- Returns:
- information about the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
drop
void drop() throws C8DBException
Deletes the collection from the database.- Throws:
C8DBException- See Also:
- API Documentation
-
drop
void drop(boolean isSystem) throws C8DBException
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.- Throws:
C8DBException- Since:
- ArangoDB 3.1.0
- See Also:
- API Documentation
-
getInfo
CollectionEntity getInfo() throws C8DBException
Returns information about the collection- Returns:
- information about the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
getProperties
CollectionPropertiesEntity getProperties() throws C8DBException
Reads the properties of the specified collection- Returns:
- properties of the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
changeProperties
CollectionPropertiesEntity changeProperties(CollectionPropertiesOptions options) throws C8DBException
Changes the properties of the collection- Parameters:
options- Additional options, can be null- Returns:
- properties of the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
rename
CollectionEntity rename(String newName) throws C8DBException
Renames the collection- Parameters:
newName- The new name- Returns:
- information about the collection
- Throws:
C8DBException- See Also:
- API Documentation
-
grantAccess
void grantAccess(String user, Permissions permissions) throws C8DBException
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 userpermissions- The permissions the user grant- Throws:
C8DBException- See Also:
- API Documentation
-
revokeAccess
void revokeAccess(String user) throws C8DBException
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- Throws:
C8DBException- See Also:
- API Documentation
-
resetAccess
void resetAccess(String user) throws C8DBException
Clear the collection access level, revert back to the default access level.- Parameters:
user- The name of the user- Throws:
C8DBException- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
getPermissions
Permissions getPermissions(String user) throws C8DBException
Get the collection access level- Parameters:
user- The name of the user- Returns:
- permissions of the user
- Throws:
C8DBException- Since:
- ArangoDB 3.2.0
- See Also:
- API Documentation
-
-