Module: WingedCouch::Models::Queries

Included in:
WingedCouch::Model
Defined in:
lib/winged_couch/models/queries.rb

Overview

Module for querying on design views

Instance Method Summary collapse

Instance Method Details

#view(view_name) ⇒ WingedCouch::QueryBuilder

Main method for building queries to CouchDB design views

Examples:

result = Model.view("cats").with_param("limit", 5).perform
# => [#<Model _id: "...", _rev: "...", ...>, ... ]
result.count
# => 5

Parameters:

  • view_name (String)

Returns:

  • (WingedCouch::QueryBuilder)

    query builder with configured path


20
21
22
23
# File 'lib/winged_couch/models/queries.rb', line 20

def view(view_name)
  view = Design::View.new(design_document, view_name)
  WingedCouch::Queries::ViewBuilder.new(view, self)
end