A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mongodb.github.io/node-mongodb-native/3.6/api/CommandCursor.html below:

Class: CommandCursor

Node.js MongoDB Driver API Class: CommandCursor
new CommandCursor(){CommandCursor} lib/command_cursor.js

,

line 45

Creates a new Command Cursor instance (INTERNAL TYPE, do not instantiate directly)

Fires: Returns: CommandCursor instance.
Extends Methods
batchSize(value){CommandCursor} lib/command_cursor.js

,

line 97

Set the batch size for the cursor.

Name Type Description value number

The number of documents to return per batch. See find command documentation.

Throws: MongoError
clone(){CommandCursor} lib/command_cursor.js

,

line 236

Clone the cursor

close(callback){Promise} lib/command_cursor.js

,

line 223

Close the cursor, sending a KillCursor command and emitting close.

Name Type Description callback CommandCursor~resultCallback optional

The result callback.

Returns: Promise if no callback passed
each(callback){null} lib/command_cursor.js

,

line 210

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 previously 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.

Name Type Description callback CommandCursor~resultCallback

The result callback.

Throws: MongoError
hasNext(callback){Promise} lib/command_cursor.js

,

line 178

Check if there is any document still available in the cursor

Name Type Description callback CommandCursor~resultCallback optional

The result callback.

Throws: MongoError Returns: Promise if no callback passed
isClosed(){boolean} lib/command_cursor.js

,

line 230

Is the cursor closed

maxTimeMS(value){CommandCursor} lib/command_cursor.js

,

line 120

Add a maxTimeMS stage to the aggregation pipeline

Name Type Description value number

The state maxTimeMS value.

next(callback){Promise} lib/command_cursor.js

,

line 170

Get the next available document from the cursor, returns null if no more documents are available.

Name Type Description callback CommandCursor~resultCallback optional

The result callback.

Throws: MongoError Returns: Promise if no callback passed
inherited pause(){null} lib/cursor.js

,

line 1102

This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer.

inherited pipe(destination, options){null} lib/cursor.js

,

line 1108

This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream.

Name Type Description destination Writable

The destination for writing data

options object optional

Pipe options

inherited read(size){String|Buffer|null} lib/cursor.js

,

line 1082

The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null.

Name Type Description size number

Optional argument to specify how much data to read.

inherited resume(){null} lib/cursor.js

,

line 1096

This method will cause the readable stream to resume emitting data events.

rewind(){CommandCursor} lib/command_cursor.js

,

line 242

Resets the cursor

inherited setEncoding(encoding){null} lib/cursor.js

,

line 1089

Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects.

Name Type Description encoding string

The encoding to use.

setReadPreference(readPreference){Cursor} lib/command_cursor.js

,

line 67

Set the ReadPreference for the cursor.

Name Type Description readPreference string | ReadPreference

The new read preference for the cursor.

Throws: MongoError
toArray(callback){Promise} lib/command_cursor.js

,

line 193

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 previously accessed.

Name Type Description callback CommandCursor~toArrayResultCallback optional

The result callback.

Throws: MongoError Returns: Promise if no callback passed
inherited unpipe(destination){null} lib/cursor.js

,

line 1116

This method will remove the hooks set up for a previous pipe() call.

Name Type Description destination Writable optional

The destination for writing data

inherited unshift(chunk){null} lib/cursor.js

,

line 1123

This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party.

Name Type Description chunk Buffer | string

Chunk of data to unshift onto the read queue.

inherited wrap(stream){null} lib/cursor.js

,

line 1130

Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See "Compatibility" below for more information.)

Name Type Description stream Stream

An "old style" readable stream.

Type Definitions
endCallback(error) lib/command_cursor.js

,

line 254

The callback error format for the forEach iterator method

Name Type Description error MongoError

An error instance representing the error during the execution.

iteratorCallback(doc) lib/command_cursor.js

,

line 248

The callback format for the forEach iterator method

Name Type Description doc Object

An emitted document for the iterator

resultCallback(error, result) lib/command_cursor.js

,

line 203

The callback format for results

Name Type Description error MongoError

An error instance representing the error during the execution.

result object | null

The result object if the command was executed successfully.

toArrayResultCallback(error, documents) lib/command_cursor.js

,

line 186

The callback format for results

Name Type Description error MongoError

An error instance representing the error during the execution.

documents Array.<object>

All the documents the satisfy the cursor.

Events
close lib/command_cursor.js

,

line 156

CommandCursor stream close event

Type:
data lib/command_cursor.js

,

line 142

CommandCursor stream data event, fired for each document in the cursor.

Type:
end lib/command_cursor.js

,

line 149

CommandCursor stream end event

Type:
readable lib/command_cursor.js

,

line 163

CommandCursor stream readable event

Type:

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4