NAME

Arango::Tango::Collection - ArangoDB Collection object

VERSION

version 0.013

USAGE

This class should not be created directly. The Arango::Tango module is responsible for creating instances of this object.

Arango::Tango::Collection answers to the following methods:

load

$ans = $collection->load();
$ans = $collection->load( count => 0 );

Loads a collection into memory.

load_indexes

$ans = $collection->load_indexes;

This route tries to cache all index entries of this collection into the main memory. Therefore it iterates over all indexes of the collection and stores the indexed values, not the entire document data, in memory.

unload

$ans = $collection->unload();

Unloads a collection from memory.

info

$info = $collection->info;

The result is an object describing the collection.

checksum

$data = $collection->checksum;

Will calculate a checksum of the meta-data (keys and optionally revision ids) and optionally the document data in the collection.

count

$n = $collection->count;

In addition to the above checksum, the result also contains the number of documents.

figures

$figures = $collection->figures;

In addition to the above (count), the result also contains the number of documents and additional statistical information about the collection.

properties

$properties = $collection->properties;

In addition to the above, the result will always contain the waitForSync attribute, and the doCompact, journalSize, and isVolatile attributes for the MMFiles storage engine.

set_properties

$properties = $collection->set_properties( waitForSync => 1 );

Changes the properties of a collection.

revision

$rev = $collection->revision;

In addition to the above, the result will also contain the collection’s revision id. The revision id is a server-generated string that clients can use to check whether data in a collection has changed since the last revision check.

create_document

$collection->create_document( { 'Hello' => 'World' } );
$collection->create_document( q!"{ "Hello": "World" }! );

Stores a document in specified collection

truncate

$collection->truncate;

Removes all documents from the collection, but leaves the indexes intact.

rotate

$status = $collection->rotate;

Rotates the journal of a collection. The current journal of the collection will be closed and made a read-only datafile. The purpose of the rotate method is to make the data in the file available for compaction (compaction is only performed for read-only datafiles, and not for journals).

Note: this method is specific for the MMFiles storage engine, and there it is not available in a cluster.

rename

my $ans = $collection->rename("newName");

Renames a collection.

recalculate_count

my $ans = $collection->recalculate_count;

Recalculates the document count of a collection, if it ever becomes inconsistent.

Note: this method is specific for the RocksDB storage engine.

document_paths

my $paths = $collection->document_paths;

Lists all collection document as their paths in the database. Returns a hash reference.

get_access_level

my $perms = $db->get_access_level($user)

Fetch the collection access level for a specific user.

set_access_level

$db->set_access_level($user, 'none')

Sets the collection access level for a specific user.

clear_access_level

$db->clear_access_level($user, 'none')

Clears the collection access level for a specific user.

AUTHOR

Alberto Simões <ambs@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2019-2020 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.