Mongoose create multiple documents

后端 未结 4 911
粉色の甜心
粉色の甜心 2020-12-29 19:39

I know in the latest version of Mongoose you can pass multiple documents to the create method, or even better in my case an array of documents.

var array = [         


        
4条回答
  •  再見小時候
    2020-12-29 20:12

    by insert function of collection db, example:

    Model.collection.insert(array, (err, list) => {
      if (err) throw err;
    
      console.log('list:', list);
    });
    

提交回复
热议问题