ArangoDB - ArangoDB client for Perl
use ArangoDB; my $db = ArangoDB->new( host => 'localhost', port => 8529, keep_alive => 1, ); # Find or create collection my $foo = $db->('foo'); # Create new document $foo->save({ x => 42, y => { a => 1, b => 2, } }); $foo->save({ x => 1, y => { a => 1, b => 10, } }); $foo->name('new_name'); # rename the collection # Create hash index. $foo->ensure_hash_index([qw/x y/]); # Simple query my $cursor = $db->('new_name')->by_example({ b => 2 }); while( my $doc = $cursor->next ){ # do something } # AQL my $cursor2 = $db->query( 'FOR u IN users FILTER u.age > @age SORT u.name ASC RETURN u' )->bind( { age => 19 } )->execute(); my $docs = $cursor2->all;
This module is an ArangoDB's REST API client for Perl.
ArangoDB is a universal open-source database with a flexible data model for documents, graphs, and key-values.
More information: http://www.arangodb.org/
This supports ArangoDB API implementation 1.01.
Constructor.
$options is HASH reference.The attributes of $options are:
Hostname or IP address of ArangoDB server.
Default: localhost
Port number of ArangoDB server.
Default: 8529
Seconds of HTTP connection timeout.
Default: 300
If it is true, use HTTP Keep-Alive connection.
Default: false
Authentication method. Supporting "Basic" only.
User name for authentication
Password for authentication
Proxy url for HTTP connection.
A callback function to customize name resolution. Takes two arguments: ($hostname, $timeout_in_seconds).
See Furl::HTTP.
Get or create a collection based on $name. Returns instance of ArangoDB::Collection.
If the Collection $name does not exist, Create it.
There is shorthand method for get collection instance.
my $collection = $db->('collection-name');
Create new collection. Returns instance of ArangoDB::Collection.
Get a Collection based on $name. Returns instance of ArangoDB::Collection.
If the collection does not exist, returns undef.
undef
Get all collections. Returns ARRAY reference.
Get AQL statement handler. Returns instance of ArangoDB::Statement.
my $sth = $db->query('FOR u IN users FILTER u.age > @age SORT u.name ASC RETURN u');
Get documnet in the collection based on $doc. Returns instance of ArangoDB::Document.
Get edge in the collection. Returns instance of ArangoDB::Edge.
Returns index object.(ArangoDB::Index::*)
See:
ArangoDB::Index::Primary
ArangoDB::Index::Hash
ArangoDB::Index::SkipList
ArangoDB::Index::Geo
ArangoDB::Index::CapConstraint
ArangoDB websie http://www.arangodb.org/
https://github.com/hideo55/p5-ArangoDB
Hideaki Ohno <hide.o.j55 {at} gmail.com>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install ArangoDB, copy and paste the appropriate command in to your terminal.
cpanm
cpanm ArangoDB
CPAN shell
perl -MCPAN -e shell install ArangoDB
For more information on module installation, please visit the detailed CPAN module installation guide.