The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

SYNOPSYS

    use Arango::DB;

    my $server = Arango::DB->new( host => '127.0.0.1',
                                  username => 'root',
                                  password => '123123123');

    my $new_database = $server->create_database("mydb");
    my $collection = $server->create_collection("mycollection");
    $collection->create_document( { 'Hello' => 'World'} );

DISCLAIMER

The module is VERY incomplete. It is being written accordingly with my personal needs. While I tried ArangoDB2 it didn't work out of the box as I expected, and decided to write a simple strightforward solution.

Patches and suggestions are VERY welcome.

USAGE

The distribution is divided in different modules, namely:

Arango::DB

This is the main module and hopefully the unique one you need to import in your code. It performs basic operations with the server, and returns objects of different kinds when needed.

Arango::DB::Database

Represents a specific database. A simple object to keep track of the database you are working with, so you do not need to specify it everytime.

Arango::DB::Collection

Represents a collection from a specific database. Again, it just keeps track of the collection name and the database where it resided.

METHODS

new

      my $db = Arango::DB->new( %options );

To start using the module you need a Arango::DB instance. Use the new method to create one. Supported options are:

host

Host name. Defaults to localhost.

port

ArangoDB Port. Defaults to 8529.

username

Username to be used to connect to ArangoDB. Defaults to root.

password

Password to be used to connect to ArangoDB. Default to the empty string.

version

    my $version_info = $db->version;
    my $detailed_info = $db->version( 'details' => 1 );

Returns a hash reference with basic server info. Detailed information can be requested with the details option.

statistics

   my $stats = $db->statistics;

Read the statistics of a server.

statistics_description

   my $stats_desc = $db->statistics_description;

Statistics description

status

   my $status = $db->status;

Return status information

time

   my $time = $db->time;

Return system time

list_databases

    my $databases = $db->list_databases;

Queries the server about available databases. Returns an array ref of database names.

create_database

    my $new_db = $db->create_database("new_db");

Creates a new database, and returns a reference to a Arango::DB::Database representing it.

database

    my $system_db = $db->database("_system");

Opens an existing database, and returns a reference to a Arango::DB::Database representing it.

delete_database

    $db->delete_database("some_db");

Deletes an existing database.

list_collections

    my $collections = $db->list_collections;

Lists collection details without specifying a specific database;

create_user

    $db->create_user('username', passwd => "3432rfsdADF");

Creates an user. Optional parameters are passwd, active and extra.

delete_user

    $db->delete_user('username');

Deletes an user.

EXCEPTIONS

This module is written to die in any exception. Please use a try/catch module or eval, to detect them.