I am using mongodb driver for NodeJs, there are 3 methods in it:
I find that db.collection.insert does the job of both insertOne as well as insertMany.
I also find the same methods for delete & Updates.
Are there any performance impact in calling the db.collection.insert method vis-a-vis the db.collection.insertOne & db.collection.insertMany methods ?
It is safe to assume that I am working in a collection which will have million records at some point in time.
There are some minor differences:
So it depends on your access pattern which to choose. In general, for performance, if you have to add multiple documents, try to make 1 call only (insert() or insertMany()) and have it unordered (if possible from application point of view). If it's a question on whether you should use (insert() or insertMany()) it depends on if you need explain() or the resulting objectIds, but there are no differencese regarding performance (if you type:
()) you'll see that both perform a