NAME

Data::CouchDB - CouchDB document management

NAME

Data::CouchDB::Connection

SYNOPSYS

my $couch_connection = Data::CouchDB::Connection->new(
    host   => 'localhost',
    port   => 5432,
    protocol => 'http://',
    couch => 'testdb',
);

DESCRIPTION

This class represents a couchdb connection.

ATTRIBUTES

host

name of the host to connect to.

port

name of the port to connect to.

db

db with which to operate.

protocol

protcol with which to connect.

Can be, 'http://' or 'https://'

couchdb

password for "couchdb" user

design_doc

Location inside the db where the design document is present.

uri

The uri with which we connect to.

log_uri

The uri we use for throwing exceptions.

ua

Optionally passed ua(user_agent). If not passed the couchdb's default ua is used.

METHODS

document

Get or set a couch document.

Usage, To get a document $couchdb->document($db, $doc_id);

To set a document
    $couchdb->document($db, $doc_id, $data);

    $data is a HashRef

view

Query a couchdb view

Usage, Without Parameters $couchdb->view($db, $viewname);

With Parameters
    $couchdb->view($db, $viewname, $parameters);

    $parameters is a HashRef

can_connect

Confirms that you can connect to this couchdb

Usage, if($couchdb->can_connect) { ... }

Returns, 1 - can read undef - otherwise

create_or_update_view

Creates a CouchDB view.

create_document

Creates a couch document

Usage, With known doc_id my $doc_id = $couchdb->create_document($db, $doc_id);

Without known doc_id or with rev
    my $doc_id = $couchdb->create_document($db);

delete_document

Deletes a couch document

Usage, $couchdb->delete_document($db, $doc_id);

create_database

Creates a CouchDB Database.

Usage, $couchdb->create_database($db);