NAME

Couchbase::View::Handle - Class for view query handles

DESCRIPTION

This is a subclass of Couchbase::Document. It contains some view-specific information. The fields of this object will only contain meaningful values once the query has been completed (i.e. if calling view_iterator, ensure the iterator has been exhausted).

Row Object

The row object (nominally, Couchbase::View::Row) is the object used to represent a single view row. This object is returned by the "next" method (when using an iterator) or as the element type of the "rows" arrayref (if using slurp mode). The row object contains the following fields

key

This is the key emitted as the first argument of the emit function in the Javascript view.

value

This is the value emitted as the second argument of the emit function in the Javascript view

id

This is the document ID associated with the row. This will only be present if the reduce function is not used in the query.

geometry

Valid only for geospatial views, contains the GeoJSON of the given result. Note that this is the geometry of the emitted item, and may be partially outside the start_range and end_range parameters.

doc

This special field contains a Couchbase::Document instance if the include_docs option was set when the query was made. The document is fetched internally by the library for each row which has a valid "id" field present.

See the view_slurp documentation for more information on include_docs

rows

Valid only in slurp mode.

Returns the rows for the query

stop

Valid only in iterator mode.

Abort iteration. This means to stop fetching extra data from the network. There will likely still be extra data available from "next"

count

Returns the total amount of rows in the result set. This does not mean the amount of rows which will be returned via the iterator, but rather the server-side count of the the rows which matched the query parameters

meta

Return the remaining JSON structure as a read-only hashref. Useful if you think the iterator is missing something.

http_code

Returns the HTTP status code for the operation, e.g 200 or 404

errinfo

Returns extended (non-http, non-libcouchbase, non-memcached) error information. This is usually a hash converted from a JSON error response.