Class: SpatialQuery

SpatialQuery


<private> new SpatialQuery()

Class for dynamically construction of spatial queries. This class should never be constructed directly, instead you should use SpatialQuery.from to construct this object.

Since:
  • 2.0.1 (stability: committed)

Members


<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)

Instantiates a SpatialQuery 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
SpatialQuery

bbox(bbox)

Specifies a bounding box to query the index for. This value must be an array of exactly 4 numbers which represents the left, top, right and bottom edges of the bounding box (in that order).

Parameters:
Name Type Description
bbox Array.<number>
Since:
  • 2.0.0 (stability: committed)
Returns:
Type
SpatialQuery

custom(opts)

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
SpatialQuery

from(ddoc, name)

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
SpatialQuery

limit(limit)

Specifies the maximum number of results to return.

Parameters:
Name Type Description
limit number
Since:
  • 2.0.0 (stability: committed)
Returns:
Type
SpatialQuery

skip(skip)

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
SpatialQuery

stale(stale)

Specifies how this query will affect view indexing, both before and after the query is executed.

Parameters:
Name Type Description
stale SpatialQuery.Update

How to update the index.

Since:
  • 2.0.0 (stability: committed)
Default Value:
  • SpatialQuery.Update.NONE
Returns:
Type
SpatialQuery