You are viewing an offline version of MongoDB documentation. Some page features might be unavailable. To view the latest version of the page or use interactive features, visit the live page.
MongoDB\InsertManyResult::getInsertedIds()
Definition
Return Values
A map of IDs (i.e. _id field values) for the inserted documents.
The index of each ID in the map corresponds to each document's position in the
bulk operation. If a document had an ID prior to inserting (i.e. the driver did
not generate an ID), the index will contain its _id field value. Any
driver-generated ID will be a MongoDB\BSON\ObjectId instance.