We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f38035b commit c2a18e4Copy full SHA for c2a18e4
src/cursor/abstract_cursor.ts
@@ -708,7 +708,9 @@ export abstract class AbstractCursor<
708
709
if (this[kId] == null) {
710
await this.cursorInit();
711
- return;
+ // If the cursor died or returned documents, return
712
+ if (this[kDocuments].length !== 0 || this.isDead) return;
713
+ // Otherwise, run a getMore
714
}
715
716
// otherwise need to call getMore
@@ -856,6 +858,11 @@ class ReadableCursorStream extends Readable {
856
858
857
859
860
private _readNext() {
861
+ if (this._cursor[kId] === Long.ZERO) {
862
+ this.push(null);
863
+ return;
864
+ }
865
+
866
// eslint-disable-next-line github/no-then
867
this._cursor.next().then(
868
result => {
0 commit comments