Class: MongoCursor

MongoCursor()

MongoCursor represents a connection to a query against the server cursors come from calling find() or aggregate and allow you to set further parameters before itterating over them or retrieving them as an array

Constructor

new MongoCursor()

Methods

limit(nToReturn)

Specify maximum number of documents to return. Default is 30 and Maximum 10,000 in simulator
Parameters:
Name Type Description
nToReturn number
Returns:
This MongoCursor for chaining

(async) next()

Gets next Document from cursor or null if no documents remain.
Returns:
Document

skip(nToSkip)

Ignore the fist x records found, default is 0
Parameters:
Name Type Description
nToSkip number
Returns:
This MongoCursor for chaining

sort(order)

Specify the order you wiush to return sorted results.
Parameters:
Name Type Description
order Object
Returns:
This MongoCursor to allow chaining

(async) toArray()

Get All documents in cursor as a single Array
Returns:
[Document]