Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

readStream options are sticky #6

@chesles

Description

@chesles

When I get a readStream({reverse: true}), followed by a plain readStream(), I get the documents out in reverse order again, unless I specify reverse: false. start and end behave similarly, the last value for each option acting as the default value for the next call.

Example:

> db.readStream().on('data', console.log)
{ key: '0', value: "blah" }
{ key: '1', value: "foo" }
{ key: '2', value: "bar" }
{ key: '3', value: "..." }

# ok, reverse the stream
> db.readStream({reverse: true}).on('data', console.log)
{ key: '3', value: "..." }
{ key: '2', value: "bar" }
{ key: '1', value: "foo" }
{ key: '0', value: "blah" }

# stream is still reversed
> db.readStream().on('data', console.log)
{ key: '3', value: "..." }
{ key: '2', value: "bar" }
{ key: '1', value: "foo" }
{ key: '0', value: "blah" }

# back to normal with reverse: false
> db.readStream({reverse: false}).on('data', console.log)
{ key: '0', value: "blah" }
{ key: '1', value: "foo" }
{ key: '2', value: "bar" }
{ key: '3', value: "..." }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions