Skip to main content
Roberty Studio
RPAMongoDB

MongoDB - Insert multiple documents

MongoDB - Insert multiple documents

Inserts several documents at once into a MongoDB collection. Returns the unique identifiers (_id) of every inserted document.


Options​

Select a collection​

Reference to the MongoDB: Select collection action the documents will be inserted into.

Documents​

Array of documents to insert, in MongoDB JSON format, for example [{ "nome": "João" }, { "nome": "Maria" }].

Select a transaction​

Reference to a MongoDB: Start transaction action when the operation must run inside a transaction. Optional field, available under the advanced options.

Returns​

Javascript code​

js
actions["action-id"].insertedIds // unique identifiers of the inserted documents (Any)

Field selection​

  • insertedIds — list with the unique identifiers (_id) of the documents inserted into the collection (Any)

Rules and Conditions​

  • The Select a collection and Documents fields are required.
  • The Documents field must be a valid JSON array with at least one object.
  • If the documents have no _id field, MongoDB generates one for each automatically.