What's the difference between 'insertMany()' and 'bulk.insert()'?

Hello!
I dont know the difference between ‘insertMany, updateMany, deleteMany’ and ‘bulk.insert, bulk.update, bulk.remove’.
What’s the difference between ‘insertMany, …’ and ‘bulk.insert, …’?
Thnx in advance.

1 Like

Hi @DongHyun_Lee,

Performance wise there is no major difference and both methods come to have less client to database round trips.

The syntax of bulk operations allow you to have a mix of updates/deletes or inserts within a bulk while insertMany will only support inserts for example.

Additionally the insertMany will execute the amount of data in the command while the bulk will only execute when the execute method is called so you van better control execution timing and logic

Best
Pavel

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.