The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Net::CouchDb::Database - Interface to a CouchDb database

SYNOPSIS

Represents a single couchdb database.

METHODS

new($couchdb, $database)

This should be created via Net::CouchDb's database method.

get($id [, rev => 'revision'])

Get a document with a specific ID, takes additional parameters for revision.

If rev is provided returns a list of the specified revisions,

Will pass other parameters on to CouchDb, see http://wiki.apache.org/couchdb/HttpDocumentApi for details of other parameters.

put($doc)

Add or update a named document.

(put and post are similar, put is only useful if you want to ensure any document inserted already has an id specified.)

post($doc)

Add or update a document.

new_doc([$fields])

Create a new empty document in memory. Takes an optional hash reference with contents. Returns a Net::CouchDb::Document object, which you should call the ->create method on to actually insert the data.

EXAMPLE

my $doc = $db->new_doc;
$doc->subject = "Test";
$doc->create or die "Failed to create";

bulk_docs([$doc1, ..., $docN])

Performs a bulk insert/update of all the documents referenced by the given array reference.

Updates the revisions and ids in the given documents.

(NB: this uses the new style bulk request, see http://wiki.apache.org/couchdb/HttpDocumentApi for details.)

delete($id)

Delete a document with the given ID

uri

Return the URI of this database.

database_info

Return the database information (doc_count, update_seq).

all_docs

Return a list of all documents.

call($method, $uri, $data)

Make a REST/JSON call, automatically adding the correct database to the URI. See Net::CouchDb::call for parameters.

AUTHOR

David Leadbeater, <dgl at dgl dot cx>

COPYRIGHT & LICENSE

Copyright 2007 David Leadbeater, all rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.