NAME
Arango::DB - A simple interface to ArangoDB REST API
VERSION
version 0.004
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' => 'true' );
Returns a hash reference with basic server info. Detailed information can be requested with the details
option.
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;
EXCEPTIONS
This module is written to die in any exception. Please use a try/catch module or eval, to detect them.
AUTHOR
Alberto Simões <ambs@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2019 by Alberto Simões.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.