public class DefaultCollectionOperations extends Object implements CollectionOperations
Modifier | Constructor and Description |
---|---|
protected |
DefaultCollectionOperations(com.arangodb.ArangoCollection collection,
Map<com.arangodb.springframework.core.template.CollectionCacheKey,com.arangodb.springframework.core.template.CollectionCacheValue> collectionCache,
PersistenceExceptionTranslator exceptionTranslator) |
Modifier and Type | Method and Description |
---|---|
long |
count()
Counts the documents in a collection
|
void |
drop()
Deletes the collection from the database.
|
void |
dropIndex(String id)
Deletes the index with the given
id from the collection. |
com.arangodb.entity.IndexEntity |
ensureFulltextIndex(Iterable<String> fields,
com.arangodb.model.FulltextIndexOptions options)
Creates a fulltext index for the collection, if it does not already exist.
|
com.arangodb.entity.IndexEntity |
ensureGeoIndex(Iterable<String> fields,
com.arangodb.model.GeoIndexOptions options)
Creates a geo-spatial index for the collection, if it does not already exist.
|
com.arangodb.entity.IndexEntity |
ensureHashIndex(Iterable<String> fields,
com.arangodb.model.HashIndexOptions options)
Creates a hash index for the collection if it does not already exist.
|
com.arangodb.entity.IndexEntity |
ensurePersistentIndex(Iterable<String> fields,
com.arangodb.model.PersistentIndexOptions options)
Creates a persistent index for the collection, if it does not already exist.
|
com.arangodb.entity.IndexEntity |
ensureSkiplistIndex(Iterable<String> fields,
com.arangodb.model.SkiplistIndexOptions options)
Creates a skip-list index for the collection, if it does not already exist.
|
Collection<com.arangodb.entity.IndexEntity> |
getIndexes()
Returns all indexes of the collection
|
com.arangodb.entity.Permissions |
getPermissions(String username)
Get the collection access level
|
com.arangodb.entity.CollectionPropertiesEntity |
getProperties()
Reads the properties of the specified collection
|
void |
grantAccess(String username,
com.arangodb.entity.Permissions permissions)
Grants or revoke access to the collection for user user.
|
String |
name()
Return the collection name
|
void |
resetAccess(String username)
Clear the collection access level, revert back to the default access level.
|
void |
truncate()
Removes all documents from the collection, but leaves the indexes intact
|
protected DefaultCollectionOperations(com.arangodb.ArangoCollection collection, Map<com.arangodb.springframework.core.template.CollectionCacheKey,com.arangodb.springframework.core.template.CollectionCacheValue> collectionCache, PersistenceExceptionTranslator exceptionTranslator)
public String name()
CollectionOperations
name
in interface CollectionOperations
public void drop() throws DataAccessException
CollectionOperations
drop
in interface CollectionOperations
DataAccessException
public void truncate() throws DataAccessException
CollectionOperations
truncate
in interface CollectionOperations
DataAccessException
public long count() throws DataAccessException
CollectionOperations
count
in interface CollectionOperations
DataAccessException
public com.arangodb.entity.CollectionPropertiesEntity getProperties() throws DataAccessException
CollectionOperations
getProperties
in interface CollectionOperations
DataAccessException
public Collection<com.arangodb.entity.IndexEntity> getIndexes() throws DataAccessException
CollectionOperations
getIndexes
in interface CollectionOperations
DataAccessException
public com.arangodb.entity.IndexEntity ensureHashIndex(Iterable<String> fields, com.arangodb.model.HashIndexOptions options) throws DataAccessException
CollectionOperations
ensureHashIndex
in interface CollectionOperations
fields
- A list of attribute pathsoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.IndexEntity ensureSkiplistIndex(Iterable<String> fields, com.arangodb.model.SkiplistIndexOptions options) throws DataAccessException
CollectionOperations
ensureSkiplistIndex
in interface CollectionOperations
fields
- A list of attribute pathsoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.IndexEntity ensurePersistentIndex(Iterable<String> fields, com.arangodb.model.PersistentIndexOptions options) throws DataAccessException
CollectionOperations
ensurePersistentIndex
in interface CollectionOperations
fields
- A list of attribute pathsoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.IndexEntity ensureGeoIndex(Iterable<String> fields, com.arangodb.model.GeoIndexOptions options) throws DataAccessException
CollectionOperations
ensureGeoIndex
in interface CollectionOperations
fields
- A list of attribute pathsoptions
- Additional options, can be nullDataAccessException
public com.arangodb.entity.IndexEntity ensureFulltextIndex(Iterable<String> fields, com.arangodb.model.FulltextIndexOptions options) throws DataAccessException
CollectionOperations
ensureFulltextIndex
in interface CollectionOperations
fields
- A list of attribute pathsoptions
- Additional options, can be nullDataAccessException
public void dropIndex(String id) throws DataAccessException
CollectionOperations
id
from the collection.dropIndex
in interface CollectionOperations
id
- The index-handleDataAccessException
public void grantAccess(String username, com.arangodb.entity.Permissions permissions)
CollectionOperations
grantAccess
in interface CollectionOperations
username
- The name of the userpermissions
- The permissions the user grantpublic void resetAccess(String username)
CollectionOperations
resetAccess
in interface CollectionOperations
username
- The name of the userpublic com.arangodb.entity.Permissions getPermissions(String username) throws DataAccessException
CollectionOperations
getPermissions
in interface CollectionOperations
username
- The name of the userDataAccessException
Copyright © 2017–2020 ArangoDB GmbH. All rights reserved.