Couch-DB

 view release on metacpan or  search on metacpan

lib/Couch/DB/Database.pod  view on Meta::CPAN

will force a rebuild of all other indices in the same file.

=over 4

=item $obj-E<gt>B<design>( [$ddocid|$ddoc|undef] )

Returns the L<Couch::DB::Design|Couch::DB::Design> object which manages a design document.
The document will not be read until an explicit call to C<get()>.
The C<$ddocid> may start with C<_design/> which will be ignored.

=item $obj-E<gt>B<designs>( [\%search|\@%search, %options] )

  [CouchDB API "GET /{db}/_design_docs", UNTESTED]
  [CouchDB API "POST /{db}/_design_docs", UNTESTED]
  [CouchDB API "POST /{db}/_design_docs/queries", UNTESTED]

Pass one or more C<%search> queries to be run.  The default returns all designs.
The search query looks very much like a generic view search, but a few
parameters are added and missing.

If there are searches, then C<GET> is used, otherwise the C<POST> version.
The returned structure depends on the searches and the number of searches.

Rows are supported.

=item $obj-E<gt>B<indexes>(%options)

  [CouchDB API "GET /{db}/_index"]

Collect all indexes for the database.  This command supports rows.

=item $obj-E<gt>B<search>( $ddoc, $index, [\%search, %options] )

Run a search (Mango or text) on the database.  The search base is
described in the C<$index> in design document C<$ddoc>.  The design
document may be specified as id or object.

» example: search

  # Twice the same
  my $r = $db->search(myddoc => myindex => \%search);
  my $r = $db->design('myddoc')->search(myindex => \%search);

=back

=head2 Handling documents

=over 4

=item $obj-E<gt>B<allDocs>( [\%query|\@queries], %options] )

  [CouchDB API "GET /{db}/_all_docs"]
  [CouchDB API "POST /{db}/_all_docs"]
  [CouchDB API "POST /{db}/_all_docs/queries", UNTESTED]
  [CouchDB API "GET /{db}/_local_docs", UNTESTED]
  [CouchDB API "POST /{db}/_local_docs", UNTESTED]
  [CouchDB API "POST /{db}/_local_docs/queries", UNTESTED]
  [CouchDB API "GET /{db}/_partition/{partition_id}/_all_docs", UNTESTED]

Get the documents, optionally limited by a view.  If there are queries,
then C<POST> is used, otherwise the C<GET> endpoint.

The returned structure depends on the C<%query> and the number of
C<@queries> (an ARRAY of query HASHes).  This method support pagination,
but only when a single query is given.

The preferred way to use this method with a C<view>, is by calling
L<Couch::DB::Design::viewDocs()|Couch::DB::Design/"Views"> on its C<design> object.

 -Option   --Default
  design     undef
  local      false
  partition  undef
  view       undef

=over 2

=item design => $design|$ddocid

Usually called via L<Couch::DB::Design::viewDocs()|Couch::DB::Design/"Views">.

=item local => BOOLEAN

Search only in local (non-replicated) documents.  This does not support
a combination with C<partition> or C<view>.

=item partition => $name

Restrict the search to the specific partition.

=item view => $name

Restrict the search to the named view.  Requires the C<design> document.

=back

» example: getting all documents in a database

Be warned: doing it this way is memory hungry: better use paging.

  my $all  = $couch->db('users')->allDocs({include_docs => 1}, all => 1);
  my $rows = $all->page;
  my @docs = map $_->doc, @$rows;

=item $obj-E<gt>B<doc>($docid, %options)

Returns a L<Couch::DB::Document|Couch::DB::Document> for this C<$docid>.  Be aware that this
does not have any interaction with the CouchDB server.  Only when you
call actions, like C<exists()>, on that object, you can see the status and
content of the document.

All C<%options> are passed to L<Couch::DB::Database::new()|Couch::DB::Database/"Constructors">.  Of course, you do
not need to pass the C<Couch::DB::Database> object explicitly.

=item $obj-E<gt>B<find>( [\%search, %options] )

  [CouchDB API "POST /{db}/_find"]
  [CouchDB API "POST /{db}/_partition/{partition_id}/_find", UNTESTED]

Search the database for matching documents, using Mango selectors.
The documents are always included in the reply, including attachment



( run in 0.575 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )