leafnode.Cursor

Instance Properties

cursor
xxx
Required
Description xxx

Methods

count  
Arguments
  • applySkipLimit (boolean) – Should the count command apply limit and skip settings on the cursor or use the passed in options.
  • options (object) – Optional settings.
  • options.skip (number) – The number of documents to skip.
  • options.limit (number) – The maximum amounts to count before aborting.
  • options.maxTimeMS (number) – Number of miliseconds to wait before aborting the query.
  • options.hint (string) – An index name hint for the query.
  • options.readPreference (ReadPreference | string) – The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Returns returns the count
Return type number
Description Get the count of documents for this cursor
limit  
Arguments
  • value (number) – The limit for the cursor query.
Throws MongoError
Return type Cursor
Description Set the limit for the cursor.
next  
Deprecated
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns the next document or null
Return type object
Description Get the next available document from the cursor, returns null if no more documents are available.
project  
Arguments
  • value (object) – field projection object.
Throws MongoError
Return type Cursor
Description Set the projection for the cursor.
setOption  
Arguments
  • field (string) – The cursor option to set [‘numberOfRetries’, ‘tailableRetryInterval’].
  • value (object) – The field value.
Throws MongoError
Return type Cursor
Description Set a node.js specific cursor option
skip  
Arguments
  • value (number) – The skip for the cursor query.
Throws Error
Return type Cursor
Description Set the skip for the cursor.
sort  
Arguments
  • keyOrList (string | array | object) – The key or a keys set used by the sort.
  • direction (number) – The direction of the sorting (1 or -1).
Throws Error
Returns xxx
Return type Cursor
Description Sets the sort order of the cursor query.
toArray  
Arguments
  • cb (function) – execute asynchronously if present (signature: cb(err, result))
Throws Error
Returns returns array of docs
Return type array
Description Returns an array of documents. The caller is responsible for making sure that there is enough memory to store the results. Note that the array only contain partial results when this cursor had been previouly accessed. In that case, cursor.rewind() can be used to reset the cursor.