<private> new ViewQuery()
Class for dynamically construction of view queries. This class should never be constructed directly, instead you should use the ViewQuery.from or ViewQuery.fromSpatial static methods to instantiate a DefaultViewQuery or SpatialViewQuery respectively.
- Since:
-
- 2.0.0 (stability: committed)
Members
-
<static, readonly> Order :number
-
Enumeration for specifying view result ordering.
Type:
- number
Properties:
Name Type Default Description ASCENDING
number 1 Orders with lower values first and higher values last.
DESCENDING
number 2 Orders with higher values first and lower values last.
-
<static, readonly> Update :number
-
Enumeration for specifying view update semantics.
Type:
- number
Properties:
Name Type Default Description BEFORE
number 1 Causes the view to be fully indexed before results are retrieved.
NONE
number 2 Allows the index to stay in whatever state it is already in prior retrieval of the query results.
AFTER
number 3 Forces the view to be indexed after the results of this query has been fetched.
Methods
-
<static> from(ddoc, name) → {DefaultViewQuery}
-
Instantiates a DefaultViewQuery object for the specified design document and view name.
Parameters:
Name Type Description ddoc
string The design document to use.
name
string The view to use.
- Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- DefaultViewQuery
-
<static> fromSpatial(ddoc, name) → {SpatialViewQuery}
-
Instantiates a SpatialViewQuery object for the specified design document and view name.
Parameters:
Name Type Description ddoc
string The design document to use.
name
string The view to use.
- Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- SpatialViewQuery
-
custom(opts) → {ViewQuery}
-
Allows you to specify custom view options that may not be available though the fluent interface defined by this class.
Parameters:
Name Type Description opts
Object - Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- ViewQuery
-
from(ddoc, name) → {ViewQuery}
-
Specifies the design document and view name to use for this query.
Parameters:
Name Type Description ddoc
string The design document to use.
name
string The view to use.
- Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- ViewQuery
-
limit(limit) → {ViewQuery}
-
Specifies the maximum number of results to return.
Parameters:
Name Type Description limit
number - Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- ViewQuery
-
skip(skip) → {ViewQuery}
-
Specifies how many results to skip from the beginning of the result set.
Parameters:
Name Type Description skip
number - Since:
-
- 2.0.0 (stability: committed)
Returns:
- Type
- ViewQuery
-
stale(stale) → {ViewQuery}
-
Specifies how this query will affect view indexing, both before and after the query is executed.
Parameters:
Name Type Description stale
ViewQuery.Update How to update the index.
- Since:
-
- 2.0.0 (stability: committed)
- Default Value:
-
- ViewQuery.Update.NONE
Returns:
- Type
- ViewQuery