view release on metacpan or  search on metacpan

lib/Arango/Tango/  view on Meta::CPAN

# ABSTRACT: ArangoDB Collection object
package Arango::DB::Collection;

use warnings;
use strict;

sub _new {
    my ($class, %opts) = @_;
    return bless {%opts} => $class;

sub create_document {
    my ($self, $body) = @_;
    die "Arango::DB | Refusing to store undefined body" unless defined($body);
    return $self->{arango}->_api('create_document', { database => $self->{database}, collection => $self->{name}, body => $body})

sub document_paths {
    my ($self) = @_;
    return $self->{arango}->_api('all_keys', { database => $self->{database}, collection => $self->{name}, type => "path"})->{result}


=head1 USAGE

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

C<Arango::DB::Collection> answers to the following methods:

=head2 C<create_document>

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

Stores a document in specified collection

=head2 C<document_paths>

   my $paths = $collection->document_paths;

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

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.961 second using v1.00-cache-1.14-grep-28634ff-cpan-207214f8fbd )