In order to query a view, the view definition must include a
suitable map function that uses the emit()
function to generate each row of information. The content of the
key that is generated by the emit() provides
the information on which you can select the data from your view.
The key can be used when querying a view as the selection mechanism, either by using an:
explicit key — show all the records matching the exact structure of the supplied key.
list of keys — show all the records matching the exact structure of each of the supplied keys (effectively showing keya or keyb or keyc).
range of keys — show all the records starting with keya and stopping on the last instance of keyb.
When querying the view results, a number of parameters can be used to select, limit, order and otherwise control the execution of the view and the information that is returned.
When a view is accessed without specifying any parameters, the view will produce results matching the following:
Full view specification, i.e. all documents are potentially output according to the view definition.
Limited to 10 items within the Admin Console, unlimited through the REST API.
Reduce function used if defined in the view.
Items sorted in ascending order (using UTF-8 comparison for strings, natural number order)
View results and the parameters operate and interact in a specific order. The interaction directly affects how queries are written and data is selected. The sequence and precedence of the different parameters during queries is shown in Figure 9.13, “Views — Querying — Flow and Parameter Interaction”.
The core arguments and selection systems are the same through both the REST API interface, and the client libraries. The setting of these values differes between different client libraries, but the argument names and expected and supported values are the same across all environments.