Package com.arangodb

Interface ArangoDatabase

    • Method Detail

      • arango

        ArangoDB arango()
        Return the main entry point for the ArangoDB driver
        Returns:
        main entry point
      • name

        String name()
        Returns the name of the database
        Returns:
        database name
      • exists

        boolean exists()
        Checks whether the database exists
        Returns:
        true if the database exists, otherwise false
      • getAccessibleDatabases

        Collection<String> getAccessibleDatabases()
        Retrieves a list of all databases the current user can access
        Returns:
        a list of all databases the current user can access
        See Also:
        API Documentation
      • collection

        ArangoCollection collection​(String name)
        Returns a ArangoCollection instance for the given collection name.
        Parameters:
        name - Name of the collection
        Returns:
        collection handler
      • createCollection

        CollectionEntity createCollection​(String name)
        Creates a collection for the given collection's name, then returns collection information from the server.
        Parameters:
        name - The name of the collection
        Returns:
        information about the collection
        See Also:
        API Documentation
      • createCollection

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

        Collection<CollectionEntity> getCollections()
        Fetches all collections from the database and returns an list of collection descriptions.
        Returns:
        list of information about all collections
        See Also:
        API Documentation
      • deleteIndex

        String deleteIndex​(String id)
        Deletes an index
        Parameters:
        id - The index-handle
        Returns:
        the id of the index
        See Also:
        API Documentation
      • create

        Boolean create()
        Creates the database
        Returns:
        true if the database was created successfully.
        See Also:
        API Documentation
      • drop

        Boolean drop()
        Deletes the database from the server.
        Returns:
        true if the database was dropped successfully
        See Also:
        API Documentation
      • grantAccess

        void grantAccess​(String user,
                         Permissions permissions)
        Grants or revoke access to the database 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
      • grantAccess

        void grantAccess​(String user)
        Grants access to the database 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
      • revokeAccess

        void revokeAccess​(String user)
        Revokes access to the database dbname 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 database 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
      • grantDefaultCollectionAccess

        void grantDefaultCollectionAccess​(String user,
                                          Permissions permissions)
        Sets the default access level for collections within this database for the 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
        Since:
        ArangoDB 3.2.0
      • getPermissions

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

        <T> ArangoCursor<T> query​(String query,
                                  Class<T> type,
                                  Map<String,​Object> bindVars,
                                  AqlQueryOptions options)
        Performs a database query using the given query and bindVars, then returns a new ArangoCursor instance for the result list.
        Parameters:
        query - An AQL query string
        type - The type of the result (POJO or RawData)
        bindVars - key/value pairs defining the variables to bind the query to
        options - Additional options that will be passed to the query API, can be null
        Returns:
        cursor of the results
        See Also:
        API Documentation
      • query

        <T> ArangoCursor<T> query​(String query,
                                  Class<T> type,
                                  AqlQueryOptions options)
        Performs a database query using the given query, then returns a new ArangoCursor instance for the result list.
        Parameters:
        query - An AQL query string
        type - The type of the result (POJO or RawData)
        options - Additional options that will be passed to the query API, can be null
        Returns:
        cursor of the results
        See Also:
        API Documentation
      • query

        <T> ArangoCursor<T> query​(String query,
                                  Class<T> type,
                                  Map<String,​Object> bindVars)
        Performs a database query using the given query and bindVars, then returns a new ArangoCursor instance for the result list.
        Parameters:
        query - An AQL query string
        type - The type of the result (POJO or RawData)
        bindVars - key/value pairs defining the variables to bind the query to
        Returns:
        cursor of the results
        See Also:
        API Documentation
      • query

        <T> ArangoCursor<T> query​(String query,
                                  Class<T> type)
        Performs a database query using the given query, then returns a new ArangoCursor instance for the result list.
        Parameters:
        query - An AQL query string
        type - The type of the result (POJO or RawData)
        Returns:
        cursor of the results
        See Also:
        API Documentation
      • cursor

        <T> ArangoCursor<T> cursor​(String cursorId,
                                   Class<T> type)
        Return an cursor from the given cursor-ID if still existing
        Parameters:
        cursorId - The ID of the cursor
        type - The type of the result (POJO or RawData)
        Returns:
        cursor of the results
        See Also:
        API Documentation
      • cursor

        <T> ArangoCursor<T> cursor​(String cursorId,
                                   Class<T> type,
                                   String nextBatchId)
        Return an cursor from the given cursor-ID if still existing
        Parameters:
        cursorId - The ID of the cursor
        type - The type of the result (POJO or RawData)
        nextBatchId - The ID of the next cursor batch (set only if cursor allows retries, see AqlQueryOptions.allowRetry(Boolean)
        Returns:
        cursor of the results
        Since:
        ArangoDB 3.11
        See Also:
        API Documentation
      • clearQueryCache

        void clearQueryCache()
        Clears the AQL query cache
        See Also:
        API Documentation
      • setQueryCacheProperties

        QueryCachePropertiesEntity setQueryCacheProperties​(QueryCachePropertiesEntity properties)
        Changes the configuration for the AQL query cache. Note: changing the properties may invalidate all results in the cache.
        Parameters:
        properties - properties to be set
        Returns:
        current set of properties
        See Also:
        API Documentation
      • getCurrentlyRunningQueries

        Collection<QueryEntity> getCurrentlyRunningQueries()
        Returns a list of currently running AQL queries
        Returns:
        a list of currently running AQL queries
        See Also:
        API Documentation
      • clearSlowQueries

        void clearSlowQueries()
        Clears the list of slow AQL queries
        See Also:
        API Documentation
      • killQuery

        void killQuery​(String id)
        Kills a running query. The query will be terminated at the next cancelation point.
        Parameters:
        id - The id of the query
        See Also:
        API Documentation
      • createAqlFunction

        void createAqlFunction​(String name,
                               String code,
                               AqlFunctionCreateOptions options)
        Create a new AQL user function
        Parameters:
        name - A valid AQL function name, e.g.: `"myfuncs::accounting::calculate_vat"`
        code - A String evaluating to a JavaScript function
        options - Additional options, can be null
        See Also:
        API Documentation
      • deleteAqlFunction

        Integer deleteAqlFunction​(String name,
                                  AqlFunctionDeleteOptions options)
        Deletes the AQL user function with the given name from the database.
        Parameters:
        name - The name of the user function to delete
        options - Additional options, can be null
        Returns:
        number of deleted functions (since ArangoDB 3.4.0)
        See Also:
        API Documentation
      • graph

        ArangoGraph graph​(String name)
        Returns a ArangoGraph instance for the given graph name.
        Parameters:
        name - Name of the graph
        Returns:
        graph handler
      • createGraph

        GraphEntity createGraph​(String name,
                                Iterable<EdgeDefinition> edgeDefinitions)
        Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition of its edges.
        Parameters:
        name - Name of the graph
        edgeDefinitions - An array of definitions for the edge
        Returns:
        information about the graph
        See Also:
        API Documentation
      • createGraph

        GraphEntity createGraph​(String name,
                                Iterable<EdgeDefinition> edgeDefinitions,
                                GraphCreateOptions options)
        Create a new graph in the graph module. The creation of a graph requires the name of the graph and a definition of its edges.
        Parameters:
        name - Name of the graph
        edgeDefinitions - An array of definitions for the edge
        options - Additional options, can be null
        Returns:
        information about the graph
        See Also:
        API Documentation
      • transaction

        <T> T transaction​(String action,
                          Class<T> type,
                          TransactionOptions options)
        Performs a server-side transaction and returns its return value.
        Parameters:
        action - A String evaluating to a JavaScript function to be executed on the server.
        type - The type of the result (POJO or RawData)
        options - Additional options, can be null
        Returns:
        the result of the transaction if it succeeded
        See Also:
        API Documentation
      • getStreamTransactions

        Collection<TransactionEntity> getStreamTransactions()
        Gets all the currently running Stream Transactions.
        Returns:
        all the currently running Stream Transactions
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • getInfo

        DatabaseEntity getInfo()
        Retrieves information about the current database
        Returns:
        information about the current database
        See Also:
        API Documentation
      • reloadRouting

        void reloadRouting()
        Reload the routing table.
        See Also:
        API Documentation
      • getViews

        Collection<ViewEntity> getViews()
        Fetches all views from the database and returns an list of view descriptions.
        Returns:
        list of information about all views
        Since:
        ArangoDB 3.4.0
        See Also:
        API Documentation
      • view

        ArangoView view​(String name)
        Returns a ArangoView instance for the given view name.
        Parameters:
        name - Name of the view
        Returns:
        view handler
        Since:
        ArangoDB 3.4.0
      • arangoSearch

        ArangoSearch arangoSearch​(String name)
        Returns a ArangoSearch instance for the given view name.
        Parameters:
        name - Name of the view
        Returns:
        ArangoSearch view handler
        Since:
        ArangoDB 3.4.0
      • searchAlias

        SearchAlias searchAlias​(String name)
        Returns a SearchAlias instance for the given view name.
        Parameters:
        name - Name of the view
        Returns:
        SearchAlias view handler
        Since:
        ArangoDB 3.10
      • createView

        ViewEntity createView​(String name,
                              ViewType type)
        Creates a view of the given type, then returns view information from the server.
        Parameters:
        name - The name of the view
        type - The type of the view
        Returns:
        information about the view
        Since:
        ArangoDB 3.4.0
      • createArangoSearch

        ViewEntity createArangoSearch​(String name,
                                      ArangoSearchCreateOptions options)
        Creates a ArangoSearch view with the given options, then returns view information from the server.
        Parameters:
        name - The name of the view
        options - Additional options, can be null
        Returns:
        information about the view
        Since:
        ArangoDB 3.4.0
        See Also:
        API Documentation
      • createSearchAlias

        ViewEntity createSearchAlias​(String name,
                                     SearchAliasCreateOptions options)
        Creates a SearchAlias view with the given options, then returns view information from the server.
        Parameters:
        name - The name of the view
        options - Additional options, can be null
        Returns:
        information about the view
        Since:
        ArangoDB 3.10
        See Also:
        API Documentation
      • createSearchAnalyzer

        SearchAnalyzer createSearchAnalyzer​(SearchAnalyzer analyzer)
        Creates an Analyzer
        Parameters:
        analyzer - SearchAnalyzer
        Returns:
        the created Analyzer
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • getSearchAnalyzer

        SearchAnalyzer getSearchAnalyzer​(String name)
        Gets information about an Analyzer
        Parameters:
        name - of the Analyzer without database prefix
        Returns:
        information about an Analyzer
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • getSearchAnalyzers

        Collection<SearchAnalyzer> getSearchAnalyzers()
        Retrieves all analyzers definitions.
        Returns:
        collection of all analyzers definitions
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • deleteSearchAnalyzer

        void deleteSearchAnalyzer​(String name)
        Deletes an Analyzer
        Parameters:
        name - of the Analyzer without database prefix
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation
      • deleteSearchAnalyzer

        void deleteSearchAnalyzer​(String name,
                                  AnalyzerDeleteOptions options)
        Deletes an Analyzer
        Parameters:
        name - of the Analyzer without database prefix
        options - AnalyzerDeleteOptions
        Since:
        ArangoDB 3.5.0
        See Also:
        API Documentation