CursorBuilder

flitter-orm/src/model/CursorBuilder~ CursorBuilder

Wrapper for building up layers to apply to a cursor when it is created.


Constructor

new CursorBuilder()

Members

layers :Array.<function()>

Functions that modify the cursor, in order. The functions take one parameter, the cursor, and return nothing.

Type:
  • Array.<function()>

Methods

apply(cursor) → {mongodb/Cursor}

Apply the builder's layers to a cursor.

Parameters:
Name Type Description
cursor mongodb/Cursor
Returns:
Type
mongodb/Cursor

filter(filter)

Add a layer that applies a filter to the cursor.

Parameters:
Name Type Description
filter module:flitter-orm/src/filter/Filter~Filter

limit(to)

Add a layer that limits the cursor.

Parameters:
Name Type Description
to number

max number of records

sort(sorts)

Add a layer that sorts the cursor.

Parameters:
Name Type Description
sorts Array.<string>

array of sorts - e.g. '+field'/'-field'/'field'