I want do a batch insert job in MongoDB and I found two ways in mongoose:
One way is use insert
:
dataArr = [
{
id: "",
name: ""
}
{
id: "",
name: ""
}
]
Collection.insert(dataArr)
and another way is Model.create
:
Model.create(dataArr)
both could complete the batch insert job, but what's the difference between them?
Which one is more efficiency?