Class Cursor<T>

Cursor to iterate and perform filtering on matched objects. This object must not be used directly. A cursor may be obtaine from calling find() on an instance of Query.

The input source of the collection

A predicate function to test documents

A projection criteria

Options

Type Parameters

  • T

Constructors

Methods

  • Return remaining objects in the cursor as an array. This method exhausts the cursor

    Returns T[]

  • Returns the number of objects return in the cursor. This method exhausts the cursor

    Returns number

  • Applies a JavaScript function for every document in a cursor.

    Parameters

    Returns void

  • Returns true if the cursor has documents and can be iterated.

    Returns boolean

  • Constrains the size of a cursor's result set.

    Parameters

    • n: number

      the number of results to limit to.

    Returns Cursor<T>

    Returns the cursor, so you can chain this call.

  • Applies a function to each document in a cursor and collects the return values in an array.

    Type Parameters

    • R

    Parameters

    Returns R[]

  • Returns a cursor that begins returning results only after passing or skipping a number of documents.

    Parameters

    • n: number

      the number of results to skip.

    Returns Cursor<T>

    Returns the cursor, so you can chain this call.

  • Returns results ordered according to a sort specification.

    Parameters

    • modifier: AnyObject

      an object of key and values specifying the sort order. 1 for ascending and -1 for descending

    Returns Cursor<T>

    Returns the cursor, so you can chain this call.