MongoDB: Bulk insert (Bulk.insert) vs insert multiple (insert([…]))

@Dummy is correct that bulk operations are generally faster than individual inserts, however, from version 2.6 and above, inserting multiple documents using collection.insert is just syntactic sugar for a BulkWrite. If you set the ordered flag to false, performance should be identical to an unordered bulk insert:

db.collection.insert(<document array>,{ordered:false})

This operation will return a BulkWriteResult, see more details in the documentation.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)