()
| 525 | } |
| 526 | |
| 527 | async hasNext(): Promise<boolean> { |
| 528 | this.signal?.throwIfAborted(); |
| 529 | |
| 530 | if (this.cursorId === Long.ZERO) { |
| 531 | return false; |
| 532 | } |
| 533 | |
| 534 | if (this.cursorOptions.timeoutMode === CursorTimeoutMode.ITERATION && this.cursorId != null) { |
| 535 | this.timeoutContext?.refresh(); |
| 536 | } |
| 537 | try { |
| 538 | do { |
| 539 | if ((this.documents?.length ?? 0) !== 0) { |
| 540 | return true; |
| 541 | } |
| 542 | await this.fetchBatch(); |
| 543 | } while (!this.isDead || (this.documents?.length ?? 0) !== 0); |
| 544 | } finally { |
| 545 | if (this.cursorOptions.timeoutMode === CursorTimeoutMode.ITERATION) { |
| 546 | this.timeoutContext?.clear(); |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | return false; |
| 551 | } |
| 552 | |
| 553 | /** Get the next available document from the cursor, returns null if no more documents are available. */ |
| 554 | async next(): Promise<TSchema | null> { |
nothing calls this directly
no test coverage detected