Constructor
new CURSOR(optionsopt)
Constructor for Cursor class
Parameters:
| Name | Type | Attributes | Default | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
{} | Configurable options for cursor (see TransformStream documentation for more details) Properties
|
- Source:
Extends
- TranformStream
Methods
_next() → {Object}
Internally used _next method (this should never be accessed directly). Resumes the transform stream and resolves the next document before pausing the stream
- Source:
Returns:
Returns a Promise which resolves with the next document written to the stream
- Type
- Object
initialize(onSuccessopt, onErroropt) → {function}
Initializes the cursor interface. Once initialized the generator will yield a single document with each next call. The behavior can be modified by passing an onSuccess function as the first argument with each next call. Once cursor is initialized the streams finish, data and error events will have registered listeners
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
onSuccess |
function |
<optional> |
defaultSuccess | A default function to be called on each successful .next call. This function can be temporarily overridden by passing a function in the .next call |
onError |
function |
<optional> |
defaultError | A default function to be called when a .next call results in an rejection |
- Source:
Returns:
Returns a generator that iteratively resolves the documents written to the stream
- Type
- function