Mongoose: what's the differences between Model.create and Collection.insert

前端 未结 3 1533
旧时难觅i
旧时难觅i 2020-12-14 18:20

I want do a batch insert job in MongoDB and I found two ways in mongoose:

One way is use insert:

dataArr = [
   {
       id: \"\",
              


        
3条回答
  •  情书的邮戳
    2020-12-14 18:40

    according to what i've read, Collection.insert is a function of mongoDB driver it's much faster when inserting big amounts of data like millions or such at the cost that it bypasses mongoose validations.

    handle with care

提交回复
热议问题