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

Method push

src/cmap/commands.ts:477–492  ·  view source on GitHub ↗

* Push a document to the document sequence. Will serialize the document * as well and return the current serialized length of all documents. * @param document - The document to add. * @param buffer - The serialized document in raw BSON. * @returns The new total document sequence length.

(document: Document, buffer: Uint8Array)

Source from the content-addressed store, hash-verified

475 * @returns The new total document sequence length.
476 */
477 push(document: Document, buffer: Uint8Array): number {
478 this.serializedDocumentsLength += buffer.length;
479 // Push the document.
480 this.documents.push(document);
481 // Push the document raw bson.
482 this.chunks.push(buffer);
483 // Write the new length.
484 if (this.header) {
485 NumberUtils.setInt32LE(
486 this.header,
487 1,
488 4 + this.field.length + 1 + this.serializedDocumentsLength
489 );
490 }
491 return this.serializedDocumentsLength + this.header.length;
492 }
493
494 /**
495 * Get the fully serialized bytes for the document sequence section.

Callers 15

constructorMethod · 0.95
abortMethod · 0.45
handleReadResultFunction · 0.45
checkOutMethod · 0.45
ensureMinPoolSizeMethod · 0.45
processWaitQueueMethod · 0.45
toBinMethod · 0.45
parseMethod · 0.45
toBinMethod · 0.45
makeSectionsMethod · 0.45
parseMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected