Cursor Stream
A streams2 wrap around MongoDB cursors because it current uses Streams1 like it's 2010.
API
var wrap = ; var cursor = dbthings;var stream = ; stream
var stream = wrap(cursor, [options])
Wraps a cursor
and returns a Stream.Readable
.
Options:
transform
- optional transformation to apply to each doc. For example, to stringify all the documents, you can dotransform: JSON.stringify
.
stream.toArray([callback]).then()
Return all the results of the cursor as an array.
Similar to cursor.toArray()
, except it returns a Promise
if no callback is passed.
stream stream