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

Method bulkWrite

src/mongo_client.ts:571–586  ·  view source on GitHub ↗

* Executes a client bulk write operation, available on server 8.0+. * @param models - The client bulk write models. * @param options - The client bulk write options. * @returns A ClientBulkWriteResult for acknowledged writes and ok: 1 for unacknowledged writes.

(
    models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>,
    options?: ClientBulkWriteOptions
  )

Source from the content-addressed store, hash-verified

569 * @returns A ClientBulkWriteResult for acknowledged writes and ok: 1 for unacknowledged writes.
570 */
571 async bulkWrite<SchemaMap extends Record<string, Document> = Record<string, Document>>(
572 models: ReadonlyArray<ClientBulkWriteModel<SchemaMap>>,
573 options?: ClientBulkWriteOptions
574 ): Promise<ClientBulkWriteResult> {
575 if (this.autoEncrypter) {
576 throw new MongoInvalidArgumentError(
577 'MongoClient bulkWrite does not currently support automatic encryption.'
578 );
579 }
580 // We do not need schema type information past this point ("as any" is fine)
581 return await new ClientBulkWriteExecutor(
582 this,
583 models as any,
584 resolveOptions(this, options)
585 ).execute();
586 }
587
588 /**
589 * An optional method to verify a handful of assumptions that are generally useful at application boot-time before using a MongoClient.

Callers

nothing calls this directly

Calls 2

resolveOptionsFunction · 0.90
executeMethod · 0.65

Tested by

no test coverage detected