MCPcopy
hub / github.com/mongodb/node-mongodb-native / readBufferedDocuments

Function readBufferedDocuments

src/cursor/abstract_cursor.ts:453–468  ·  view source on GitHub ↗

Returns current buffered documents

(number?: number)

Source from the content-addressed store, hash-verified

451
452 /** Returns current buffered documents */
453 readBufferedDocuments(number?: number): NonNullable<TSchema>[] {
454 const bufferedDocs: NonNullable<TSchema>[] = [];
455 const documentsToRead = Math.min(
456 number ?? this.documents?.length ?? 0,
457 this.documents?.length ?? 0
458 );
459
460 for (let count = 0; count < documentsToRead; count++) {
461 const document = this.documents?.shift(this.deserializationOptions);
462 if (document != null) {
463 bufferedDocs.push(document);
464 }
465 }
466
467 return bufferedDocs;
468 }
469
470 async *[Symbol.asyncIterator](): AsyncGenerator<TSchema, void, void> {
471 this.signal?.throwIfAborted();

Callers

nothing calls this directly

Calls 3

minMethod · 0.45
shiftMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected