Add a cursor flag to the cursor
Add a cursor flag to the cursor
The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'partial'].
The flag boolean value.
Add a query modifier to the cursor query
Add a query modifier to the cursor query
The query modifier (must start with $, such as $orderby etc)
The flag boolean value.
Sets the batch size parameter of this cursor to the given value.
Sets the batch size parameter of this cursor to the given value.
the new batch size.
this optional callback will be called after executing this method. The first parameter will contain an error object when the batchSize given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
batchSize(size[, callback])
Sets the batch size parameter of this cursor to the given value.
Sets the batch size parameter of this cursor to the given value.
the new batch size.
a promise of the Cursor
batchSize(size[, callback])
Clone the cursor
Clone the cursor
Close the cursor, sending a KillCursor command and emitting close.
Close the cursor, sending a KillCursor command and emitting close.
this will be called after executing this method. The first parameter will always contain null while the second parameter will contain a reference to this cursor.
Close the cursor, sending a KillCursor command and emitting close.
Close the cursor, sending a KillCursor command and emitting close.
a promise of the Cursor
Set the collation options for the cursor.
Set the collation options for the cursor.
the cursor collation options (MongoDB 3.4 or higher) settings for update operation (see 3.4 documentation for available fields).
the Cursor
Add a comment to the cursor query allowing for tracking the comment in the log.
Add a comment to the cursor query allowing for tracking the comment in the log.
The comment attached to this query.
the Cursor
Determines how many result the query for this cursor will return
Determines how many result the query for this cursor will return
if set to true will apply the skip and limits set on the cursor. Defaults to false.
this will be called after executing this method. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the number of results or null if an error occurred.
count(applySkipLimit, [options], callback)
Determines how many result the query for this cursor will return
Determines how many result the query for this cursor will return
if set to true will apply the skip and limits set on the cursor. Defaults to false.
the optional settings.
this will be called after executing this method. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the number of results or null if an error occurred.
count(applySkipLimit, [options], callback)
Determines how many result the query for this cursor will return
Determines how many result the query for this cursor will return
if set to true will apply the skip and limits set on the cursor. Defaults to false.
the optional settings.
a promise of the count
count(applySkipLimit, [options])
Gets a detailed information about how the query is performed on this cursor and how long it took the database to process it.
Gets a detailed information about how the query is performed on this cursor and how long it took the database to process it.
this will be called after executing this method. The first parameter will always be null while the second parameter will be an object containing the details.
explain(callback)
Set the cursor query
Set the cursor query
The filter object used for the cursor.
Iterates over all the documents for this cursor using the iterator, callback pattern.
Iterates over all the documents for this cursor using the iterator, callback pattern.
The iteration callback.
The end callback.
Set the cursor hint
Set the cursor hint
If specified, then the query system will only consider plans using the hinted index.
Check if the cursor is closed or open.
Check if the cursor is closed or open.
the state of the cursor.
Sets the limit parameter of this cursor to the given value.
Sets the limit parameter of this cursor to the given value.
the new limit.
this optional callback will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
limit(limit[, callback])
Map all documents using the provided function
Map all documents using the provided function
The mapping transformation method.
Set the cursor max
Set the cursor max
Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order.
Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)
Set a maxAwaitTimeMS on a tailing cursor query to allow to customize the timeout value for the option awaitData (Only supported on MongoDB 3.2 or higher, ignored otherwise)
Number of milliseconds to wait before aborting the tailed query.
Set the cursor maxScan
Set the cursor maxScan
Constrains the query to only scan the specified number of documents when fulfilling the query
Specifies a time limit for a query operation.
Specifies a time limit for a query operation. After the specified time is exceeded, the operation will be aborted and an error will be returned to the client. If maxTimeMS is null, no limit is applied.
the maxTimeMS for the query.
this optional callback will be called after executing this method. The first parameter will contain an error object when the limit given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
maxTimeMS(maxTimeMS[, callback])
Set the cursor min
Set the cursor min
Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order.
Get the next available document from the cursor, returns null if no more documents are available.
Get the next available document from the cursor, returns null if no more documents are available.
promise if no callback passed
Get the next available document from the cursor, returns null if no more documents are available.
Get the next available document from the cursor, returns null if no more documents are available.
The result callback.
promise if no callback passed
Gets the next document from the cursor.
Gets the next document from the cursor.
The result callback.
promise if no callback passed
Sets a field projection for the query.
Sets a field projection for the query.
The field projection object.
Set the cursor returnKey
Set the cursor returnKey
Only return the index field or fields for the results of the query. If $returnKey is set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields.
Resets this cursor to its initial state.
Resets this cursor to its initial state. All settings like the query string, tailable, batchSizeValue, skipValue and limits are preserved.
Sets the read preference for the cursor
Sets the read preference for the cursor
read preference for the cursor, one of Server.READ_PRIMARY, Server.READ_SECONDARY, Server.READ_SECONDARY_ONLY
this optional callback will be called after executing this method. The first parameter will contain an error object when the read preference given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
setReadPreference(pref[, callback])
Set the cursor showRecordId
Set the cursor showRecordId
The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find.
Sets the skip parameter of this cursor to the given value.
Sets the skip parameter of this cursor to the given value.
the new skip value.
this optional callback will be called after executing this method. The first parameter will contain an error object when the skip value given is not a valid number or when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
skip(skip[, callback])
TODO document me
Sets the sort parameter of this cursor to the given value.
Sets the sort parameter of this cursor to the given value.
this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].
this determines how the results are sorted. "asc", "ascending" or 1 for ascending order while "desc", "descending or -1 for descending order. Note that the strings are case insensitive.
sort(keyOrList, direction, callback)
Sets the sort parameter of this cursor to the given value.
Sets the sort parameter of this cursor to the given value.
this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].
this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
sort(keyOrList, direction, callback)
Sets the sort parameter of this cursor to the given value.
Sets the sort parameter of this cursor to the given value.
this can be a string or an array. If passed as a string, the string will be the field to sort. If passed an array, each element will represent a field to be sorted and should be an array that contains the format [string, direction].
this determines how the results are sorted. "asc", "ascending" or 1 for ascending order while "desc", "descending or -1 for descending order. Note that the strings are case insensitive.
this will be called after executing this method. The first parameter will contain an error object when the cursor is already closed while the second parameter will contain a reference to this object upon successful execution.
sort(keyOrList, direction, callback)
Returns a Node Transform Stream interface for this cursor.
Returns a Node Transform Stream interface for this cursor.
returns a stream object.
Returns a Node Transform Stream interface for this cursor.
Returns a Node Transform Stream interface for this cursor.
var stream = collection.find({mykey:{$ne:2}}).stream(); stream.on("data", function(item) {}); stream.on("end", function() {});
returns a stream object.
Returns an array of documents.
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.
This will be called after executing this method successfully. The first parameter will contain the Error object if an error occurred, or null otherwise. The second parameter will contain an array of BSON deserialized objects as a result of the query.
Iterates over all the documents for this cursor.
Iterates over all the documents for this cursor. As with {cursor.toArray}, not all of the elements will be iterated if this cursor had been previouly accessed. In that case, {cursor.rewind} can be used to reset the cursor. However, unlike {cursor.toArray}, the cursor will only hold a maximum of batch size elements at any given time if batch size is specified. Otherwise, the caller is responsible for making sure that the entire result can fit the memory.
this will be called for while iterating every document of the query result. The first parameter will contain the Error object if an error occurred, or null otherwise. While the second parameter will contain the document.
(Since version 2.2) No alternatives specified
Gets the next document from the cursor.
Gets the next document from the cursor.
promise if no callback passed
(Since version 2.0) Use next() instead
Cursor
https://mongodb.github.io/node-mongodb-native/api-generated/cursor.html