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

Function insert

src/bulk/common.ts:980–986  ·  view source on GitHub ↗

* Add a single insert document to the bulk operation * * @example * ```ts * const bulkOp = collection.initializeOrderedBulkOp(); * * // Adds three inserts to the bulkOp. * bulkOp * .insert({ a: 1 }) * .insert({ b: 2 }) * .insert({ c: 3 }); * await bulkOp.execut

(document: Document)

Source from the content-addressed store, hash-verified

978 * ```
979 */
980 insert(document: Document): BulkOperationBase {
981 maybeAddIdToDocuments(this.collection, document, {
982 forceServerObjectId: this.shouldForceServerObjectId()
983 });
984
985 return this.addToOperationsList(BatchType.INSERT, document);
986 }
987
988 /**
989 * Builds a find operation for an update/updateOne/delete/deleteOne/replaceOne.

Callers

nothing calls this directly

Calls 2

maybeAddIdToDocumentsFunction · 0.90
addToOperationsListMethod · 0.45

Tested by

no test coverage detected