MongoDB Bulk icon

MongoDB Bulk

Perform bulk operations on MongoDB collections

Insert Many

AI-generated

Summary

Insert multiple documents into a MongoDB collection

Inputs

  • collection (required) — MongoDB Collection Name
  • documents — Array of documents to insert
  • dateFields — Comma‑separated list of field names that should be converted to Date objects (e.g., timestamp,createdAt,updatedAt)
  • options — Insert options such as ordered execution and bypass document validation

Output shape

array of inserted document acknowledgment objects

Each entry contains the MongoDB insert result (e.g., insertedCount, insertedIds); the overall output is an array keyed by each processed item.

Examples

Example 1: Add two new user records

collection: users, documents: [{"name":"Alice"},{"name":"Bob"}], options: {"ordered":true}

Example 2: Batch insert ordered with date conversion

collection: orders, documents: [["2023-01-01","2023-02-01"],{"date":"2023-03-01"}], dateFields: "timestamp", options: {"ordered":false}

Discussion