NAME
ArangoDB - ArangoDB client for Perl.
SYNOPSIS
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->create_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 $cur = $db->query(
'FOR u IN users FILTER u.age > @age SORT u.name ASC RETURN u'
)->bind( { age => 19 } )->execute();
DESCRIPTION
ArangoDB is ArangoDB client for Perl.
SUPPORT API VERSION
This supports ArangoDB API implementation 1.01.
METHODS
new($options)
Constructor. $options is HASH reference.The attributes of $options are:
- host
-
Hostname or IP address of ArangoDB server. Default: localhost
- port
-
Port number of ArangoDB server. Default: 8529
- timeout
-
Seconds of HTTP connection timeout.
- auth_user
-
User name for authentication
- auth_passwd
-
Password for authentication
- auth_type
-
Authentication method. Supporting "Basic" only.
- keep_alive
-
If it is true, use HTTP Keep-Alive connection. Default: false
- proxy
-
HTTP proxy.
create($name)
Create new collection. Returns instance of ArangoDB::Collection.
find($name)
Get a Collection based on $name. Returns instance of ArangoDB::Collection. If the collection does not exist, returns undef
.
collection($name)
Get or create a Collection based on $name. If the Collection $name does not exist, Create it.
collections()
Get all collections. Returns ARRAY reference.
drop($name)
Drop collection. Same as `$db->collection($name)->drop();`.
truncate($name)
Truncate a collection. Same as `$db->collection($name)->truncate();`.
get_index($index_id)
Returns instance of ArangoDB::Index::*.
drop_index($index_id)
Drop a index.
query($query)
Returns instance of ArangoDB::Statement.
AUTHOR
Hideaki Ohno <hide.o.j55 {at} gmail.com>
SEE ALSO
ArangoDB websie http://www.arangodb.org/
LICENSE
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.