- Stitch >
- MongoDB Atlas >
- Reference >
- MongoDB Actions
collection.insertMany()¶
On this page
Definition¶
-
collection.
insertMany
()¶
Insert one or more documents into a collection and return a list of the
_id
values for each inserted document.
Usage¶
Example¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
To call the collection.insertMany()
action from a
Function, get a collection handle with
database.collection()
then call the handle’s
insertMany()
method.
To call the collection.insertMany()
action from a
JavaScript SDK, use the RemoteMongoCollection.insertMany() method.
To call the collection.insertMany()
action from the
Java/Android SDK, use the RemoteMongoCollection.insertMany() method.
To call the collection.insertMany()
action from the
Swift/iOS SDK, use the RemoteMongoCollection.insertMany() method.
Parameters¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The collection.insertMany()
action has the following form:
Parameter | Description |
---|---|
Insert Document documents: Array<document> |
An array of documents to insert into the collection. |
The insertMany() method has the following form:
Parameter | Description |
---|---|
Insert Document documents: Array<document> |
An array of documents to insert into the collection. |
The insertMany() method has the following form:
Parameter | Description |
---|---|
Insert Document documents: Array<document> |
An array of documents to insert into the collection. |
The insertMany() method has the following form:
Parameter | Description |
---|---|
Insert Document documents: Array<document> |
An array of documents to insert into the collection. |
Return Value¶
- Functions
- JavaScript SDK
- Android SDK
- iOS SDK
The collection.insertMany()
action returns a Promise that
resolves to a document that describes the insert operation.
The RemoteMongoCollection.insertMany() method returns a Promise that resolves to a RemoteInsertManyResult object that describes the insert operation.
The RemoteMongoCollection.insertMany() method returns a Task that resolves to a RemoteInsertManyResult object that describes the insert operation.
The RemoteMongoCollection.insertMany() method returns a StitchResult enum that resolves to a RemoteInsertManyResult object that describes the insert operation.
Value | Description |
---|---|
Inserted IDs result.insertedIds: Array<ObjectID> result.insertedIds: Document<Number, ObjectID> result.insertedIds: Map<Long, ObjectID> result.insertedIds: Document<Int64, ObjectID> |
An array that contains the A document that contains the A A document that contains the |