@ThreadSafe public interface ArangoCollection extends ArangoSerializationAccessor
Modifier and Type | Method and Description |
---|---|
CollectionPropertiesEntity |
changeProperties(CollectionPropertiesOptions options)
Changes the properties of the collection
|
CollectionPropertiesEntity |
count()
Counts the documents in a collection
|
CollectionPropertiesEntity |
count(CollectionCountOptions options)
Counts the documents in a collection
|
CollectionEntity |
create()
Creates a collection for this collection's name, then returns collection information from the server.
|
CollectionEntity |
create(CollectionCreateOptions options)
Creates a collection with the given
options for this collection's name, then returns collection
information from the server. |
ArangoDatabase |
db()
The the handler of the database the collection is within
|
DocumentDeleteEntity<Void> |
deleteDocument(String key)
Deletes the document with the given
key from the collection. |
<T> DocumentDeleteEntity<T> |
deleteDocument(String key,
Class<T> type,
DocumentDeleteOptions options)
Deletes the document with the given
key from 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.
|
String |
deleteIndex(String id)
Deletes the index with the given
id from the collection. |
Boolean |
documentExists(String key)
Checks if the document exists by reading a single document head
|
Boolean |
documentExists(String key,
DocumentExistsOptions options)
Checks if the document exists by reading a single document head
|
void |
drop()
Deletes the collection from the database.
|
void |
drop(boolean isSystem)
Deletes the collection from the database.
|
IndexEntity |
ensureFulltextIndex(Iterable<String> fields,
FulltextIndexOptions options)
Deprecated.
since ArangoDB 3.10, use ArangoSearch or Inverted indexes instead.
|
IndexEntity |
ensureGeoIndex(Iterable<String> fields,
GeoIndexOptions options)
Creates a geo-spatial index for the collection, if it does not already exist.
|
IndexEntity |
ensureHashIndex(Iterable<String> fields,
HashIndexOptions options)
Deprecated.
use
ensurePersistentIndex(Iterable, PersistentIndexOptions) instead. Since ArangoDB 3.7 a
hash index is an alias for a persistent index. |
InvertedIndexEntity |
ensureInvertedIndex(InvertedIndexOptions options)
Creates an inverted index for the collection, if it does not already exist.
|
IndexEntity |
ensurePersistentIndex(Iterable<String> fields,
PersistentIndexOptions options)
Creates a persistent index for the collection, if it does not already exist.
|
IndexEntity |
ensureSkiplistIndex(Iterable<String> fields,
SkiplistIndexOptions options)
Deprecated.
use
ensurePersistentIndex(Iterable, PersistentIndexOptions) instead. Since ArangoDB 3.7 a
skiplist index is an alias for a persistent index. |
IndexEntity |
ensureTtlIndex(Iterable<String> fields,
TtlIndexOptions options)
Creates a ttl index for the collection, if it does not already exist.
|
IndexEntity |
ensureZKDIndex(Iterable<String> fields,
ZKDIndexOptions options)
Creates a ZKD multi-dimensional index for the collection, if it does not already exist.
|
boolean |
exists()
Checks whether the collection exists
|
<T> T |
getDocument(String key,
Class<T> type)
Retrieves the document with the given
key from the collection. |
<T> T |
getDocument(String key,
Class<T> type,
DocumentReadOptions options)
Retrieves the document with the given
key from the collection. |
<T> MultiDocumentEntity<T> |
getDocuments(Collection<String> keys,
Class<T> type)
Retrieves multiple documents with the given
_key from the collection. |
<T> MultiDocumentEntity<T> |
getDocuments(Collection<String> keys,
Class<T> type,
DocumentReadOptions options)
Retrieves multiple documents with the given
_key from the collection. |
IndexEntity |
getIndex(String id)
Fetches information about the index with the given
id and returns it. |
Collection<IndexEntity> |
getIndexes()
Fetches a list of all indexes on this collection.
|
CollectionEntity |
getInfo()
Returns information about the collection
|
InvertedIndexEntity |
getInvertedIndex(String id)
Fetches information about the inverted index with the given
id and returns it. |
Collection<InvertedIndexEntity> |
getInvertedIndexes()
Fetches a list of all inverted indexes on this collection.
|
Permissions |
getPermissions(String user)
Get the collection access level
|
CollectionPropertiesEntity |
getProperties()
Reads the properties of the specified collection
|
ShardEntity |
getResponsibleShard(Object value)
Returns the responsible shard for the document.
|
CollectionRevisionEntity |
getRevision()
Retrieve the collections revision
|
void |
grantAccess(String user,
Permissions permissions)
Grants or revoke access to the collection for user user.
|
DocumentImportEntity |
importDocuments(Collection<?> values)
Bulk imports the given values into the collection.
|
DocumentImportEntity |
importDocuments(Collection<?> values,
DocumentImportOptions options)
Bulk imports the given values into the collection.
|
DocumentImportEntity |
importDocuments(String values)
Bulk imports the given values into the collection.
|
DocumentImportEntity |
importDocuments(String values,
DocumentImportOptions options)
Bulk imports the given values into the collection.
|
<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.
|
CollectionEntity |
load()
Deprecated.
MMFiles only
|
String |
name()
The name of the collection
|
CollectionEntity |
rename(String newName)
Renames the collection
|
<T> DocumentUpdateEntity<T> |
replaceDocument(String key,
T value)
Replaces the document with
key with 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 with
key with 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.
|
void |
resetAccess(String user)
Clear the collection access level, revert back to the default access level.
|
void |
revokeAccess(String user)
Revokes access to the collection for user user.
|
CollectionEntity |
truncate()
Removes all documents from the collection, but leaves the indexes intact
|
CollectionEntity |
truncate(CollectionTruncateOptions options)
Removes all documents from the collection, but leaves the indexes intact
|
CollectionEntity |
unload()
Deprecated.
MMFiles only
|
<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,U> DocumentUpdateEntity<U> |
updateDocument(String key,
T value,
DocumentUpdateOptions options,
Class<U> returnType)
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.
|
<T,U> MultiDocumentEntity<DocumentUpdateEntity<U>> |
updateDocuments(Collection<T> values,
DocumentUpdateOptions options,
Class<U> returnType)
Partially updates documents, the documents to update are specified by the _key attributes in the objects on
values.
|
util, util
ArangoDatabase db()
String name()
<T> DocumentCreateEntity<T> insertDocument(T value) throws ArangoDBException
value
- A representation of a single document (POJO, VPackSlice or String for JSON)ArangoDBException
<T> DocumentCreateEntity<T> insertDocument(T value, DocumentCreateOptions options) throws ArangoDBException
value
- A representation of a single document (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(Collection<T> values) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- A List of documents (POJO, VPackSlice or String for JSON)ArangoDBException
<T> MultiDocumentEntity<DocumentCreateEntity<T>> insertDocuments(Collection<T> values, DocumentCreateOptions options) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- A List of documents (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
DocumentImportEntity importDocuments(Collection<?> values) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- a list of Objects that will be stored as documentsArangoDBException
DocumentImportEntity importDocuments(Collection<?> values, DocumentImportOptions options) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- a list of Objects that will be stored as documentsoptions
- Additional options, can be nullArangoDBException
DocumentImportEntity importDocuments(String values) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- JSON-encoded array of objects that will be stored as documentsArangoDBException
DocumentImportEntity importDocuments(String values, DocumentImportOptions options) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- JSON-encoded array of objects that will be stored as documentsoptions
- Additional options, can be nullArangoDBException
<T> T getDocument(String key, Class<T> type) throws ArangoDBException
key
from the collection.key
- The key of the documenttype
- The type of the document (POJO class, VPackSlice or String for JSON)ArangoDBException
<T> T getDocument(String key, Class<T> type, DocumentReadOptions options) throws ArangoDBException
key
from the collection.key
- The key of the documenttype
- The type of the document (POJO class, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T> MultiDocumentEntity<T> getDocuments(Collection<String> keys, Class<T> type) throws ArangoDBException
_key
from the collection.keys
- The keys of the documentstype
- The type of the documents (POJO class, VPackSlice or String for JSON)ArangoDBException
<T> MultiDocumentEntity<T> getDocuments(Collection<String> keys, Class<T> type, DocumentReadOptions options) throws ArangoDBException
_key
from the collection.keys
- The keys of the documentstype
- The type of the documents (POJO class, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T> DocumentUpdateEntity<T> replaceDocument(String key, T value) throws ArangoDBException
key
with the one in the body, provided there is such a document and no
precondition is violatedkey
- The key of the documentvalue
- A representation of a single document (POJO, VPackSlice or String for JSON)ArangoDBException
<T> DocumentUpdateEntity<T> replaceDocument(String key, T value, DocumentReplaceOptions options) throws ArangoDBException
key
with the one in the body, provided there is such a document and no
precondition is violatedkey
- The key of the documentvalue
- A representation of a single document (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> replaceDocuments(Collection<T> values) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- A List of documents (POJO, VPackSlice or String for JSON)ArangoDBException
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> replaceDocuments(Collection<T> values, DocumentReplaceOptions options) throws ArangoDBException
Limitations:
- the fields having null
value are always removed during serialization
values
- A List of documents (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T> DocumentUpdateEntity<T> updateDocument(String key, T value) throws ArangoDBException
key
- The key of the documentvalue
- A representation of a single document (POJO, VPackSlice or String for JSON)ArangoDBException
<T> DocumentUpdateEntity<T> updateDocument(String key, T value, DocumentUpdateOptions options) throws ArangoDBException
key
- The key of the documentvalue
- A representation of a single document (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T,U> DocumentUpdateEntity<U> updateDocument(String key, T value, DocumentUpdateOptions options, Class<U> returnType) throws ArangoDBException
key
- The key of the documentvalue
- A representation of a single document (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullreturnType
- Type of the returned newDocument and/or oldDocumentArangoDBException
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments(Collection<T> values) throws ArangoDBException
values
- A list of documents (POJO, VPackSlice or String for JSON)ArangoDBException
<T> MultiDocumentEntity<DocumentUpdateEntity<T>> updateDocuments(Collection<T> values, DocumentUpdateOptions options) throws ArangoDBException
values
- A list of documents (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullArangoDBException
<T,U> MultiDocumentEntity<DocumentUpdateEntity<U>> updateDocuments(Collection<T> values, DocumentUpdateOptions options, Class<U> returnType) throws ArangoDBException
values
- A list of documents (POJO, VPackSlice or String for JSON)options
- Additional options, can be nullreturnType
- Type of the returned newDocument and/or oldDocumentArangoDBException
DocumentDeleteEntity<Void> deleteDocument(String key) throws ArangoDBException
key
from the collection.key
- The key of the documentArangoDBException
<T> DocumentDeleteEntity<T> deleteDocument(String key, Class<T> type, DocumentDeleteOptions options) throws ArangoDBException
key
from the collection.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 nullArangoDBException
MultiDocumentEntity<DocumentDeleteEntity<Void>> deleteDocuments(Collection<?> values) throws ArangoDBException
values
- The keys of the documents or the documents themselvesArangoDBException
<T> MultiDocumentEntity<DocumentDeleteEntity<T>> deleteDocuments(Collection<?> values, Class<T> type, DocumentDeleteOptions options) throws ArangoDBException
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 nullArangoDBException
Boolean documentExists(String key)
key
- The key of the documentBoolean documentExists(String key, DocumentExistsOptions options) throws ArangoDBException
key
- The key of the documentoptions
- Additional options, can be nullArangoDBException
- only thrown when DocumentExistsOptions.isCatchException()
== falseIndexEntity getIndex(String id) throws ArangoDBException
id
and returns it.
getInvertedIndex(String)
instead.id
- The index-handleArangoDBException
InvertedIndexEntity getInvertedIndex(String id) throws ArangoDBException
id
and returns it.id
- The index-handleArangoDBException
String deleteIndex(String id) throws ArangoDBException
id
from the collection.id
- The index-handleArangoDBException
@Deprecated IndexEntity ensureHashIndex(Iterable<String> fields, HashIndexOptions options) throws ArangoDBException
ensurePersistentIndex(Iterable, PersistentIndexOptions)
instead. Since ArangoDB 3.7 a
hash index is an alias for a persistent index.fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
@Deprecated IndexEntity ensureSkiplistIndex(Iterable<String> fields, SkiplistIndexOptions options) throws ArangoDBException
ensurePersistentIndex(Iterable, PersistentIndexOptions)
instead. Since ArangoDB 3.7 a
skiplist index is an alias for a persistent index.fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
IndexEntity ensurePersistentIndex(Iterable<String> fields, PersistentIndexOptions options) throws ArangoDBException
fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
IndexEntity ensureGeoIndex(Iterable<String> fields, GeoIndexOptions options) throws ArangoDBException
fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
@Deprecated IndexEntity ensureFulltextIndex(Iterable<String> fields, FulltextIndexOptions options) throws ArangoDBException
fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
IndexEntity ensureTtlIndex(Iterable<String> fields, TtlIndexOptions options) throws ArangoDBException
fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
IndexEntity ensureZKDIndex(Iterable<String> fields, ZKDIndexOptions options) throws ArangoDBException
fields
- A list of attribute pathsoptions
- Additional options, can be nullArangoDBException
InvertedIndexEntity ensureInvertedIndex(InvertedIndexOptions options) throws ArangoDBException
options
- index creation optionsArangoDBException
Collection<IndexEntity> getIndexes() throws ArangoDBException
getInvertedIndexes()
instead.ArangoDBException
Collection<InvertedIndexEntity> getInvertedIndexes() throws ArangoDBException
ArangoDBException
boolean exists() throws ArangoDBException
ArangoDBException
CollectionEntity truncate() throws ArangoDBException
ArangoDBException
CollectionEntity truncate(CollectionTruncateOptions options) throws ArangoDBException
options
- ArangoDBException
CollectionPropertiesEntity count() throws ArangoDBException
ArangoDBException
CollectionPropertiesEntity count(CollectionCountOptions options) throws ArangoDBException
options
- ArangoDBException
CollectionEntity create() throws ArangoDBException
ArangoDBException
CollectionEntity create(CollectionCreateOptions options) throws ArangoDBException
options
for this collection's name, then returns collection
information from the server.options
- Additional options, can be nullArangoDBException
void drop() throws ArangoDBException
ArangoDBException
void drop(boolean isSystem) throws ArangoDBException
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.ArangoDBException
@Deprecated CollectionEntity load() throws ArangoDBException
ArangoDBException
@Deprecated CollectionEntity unload() throws ArangoDBException
ArangoDBException
CollectionEntity getInfo() throws ArangoDBException
ArangoDBException
CollectionPropertiesEntity getProperties() throws ArangoDBException
ArangoDBException
CollectionPropertiesEntity changeProperties(CollectionPropertiesOptions options) throws ArangoDBException
options
- Additional options, can be nullArangoDBException
CollectionEntity rename(String newName) throws ArangoDBException
newName
- The new nameArangoDBException
ShardEntity getResponsibleShard(Object value)
value
- A projection of the document containing at least the shard key (_key or a custom attribute) for
which the responsible shard should be determinedArangoDBException
CollectionRevisionEntity getRevision() throws ArangoDBException
ArangoDBException
void grantAccess(String user, Permissions permissions) throws ArangoDBException
user
- The name of the userpermissions
- The permissions the user grantArangoDBException
void revokeAccess(String user) throws ArangoDBException
user
- The name of the userArangoDBException
void resetAccess(String user) throws ArangoDBException
user
- The name of the userArangoDBException
Permissions getPermissions(String user) throws ArangoDBException
user
- The name of the userArangoDBException
Copyright © 2016–2022 ArangoDB GmbH. All rights reserved.