0 votes
1 view
in Web Technology by (47.7k points)

I won’t do a batch insert job in MongoDB and I found two ways in mongoose:

One way is to use insert:

dataArr = [ 

id: "", 

name: "" 

id: "", 

name: "" 



and another way is Model.create:


both could complete the batch insert job, but what's the difference between them?

Which one is more efficient?

1 Answer

0 votes
by (107k points)

The differences in Mongoose, there is Model.create and Collection.insert the latter isn't strictly part of Mongoose, but of the underlying MongoDB driver.

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !