Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/change_stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,11 @@ export class ChangeStream<
return this.cursor?.resumeToken;
}

/** Returns the currently buffered documents length of the underlying cursor. */
get bufferedCount(): number | undefined {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's change this to return number in all cases: if there is no cursor, we should return 0.

return this.cursor?.bufferedCount();
}

/** Check if there is any document still available in the Change Stream */
async hasNext(): Promise<boolean> {
this._setIsIterator();
Expand Down