Q:

Sails Model.create

I'm teaching myself Sails by following a book. 
In the book the code should be:
Video.create(foundVideos).exec(function(err, videoRecordsCreated){
            if(err){
              console.log('err', err);

              return cb(err);
            }
            console.log('videoRecordsCreated', videoRecordsCreated);
          });

However after running sails lift
I am getting the following error:

err { UsageError: Invalid new record.  Details:   Got an array, but
  expected new record to be provided as a dictionary (plain JavaScript
  object).   Array usage is no longer supported as of Sails v1.0 /
  Waterline 0.13.   Instead, please explicitly call .createEach(). 
at Object.success (/Users/bliss/Documents/Coder/Sails/brushfire/config/bootstrap.js:72:17)
at afterwards (/Users/bliss/Documents/Coder/Sails/brushfire/node_modules/machinepack-youtube/node_modules/machine/lib/intercept-exit-callbacks.js:131:21)
at Timeout._onTimeout (/Users/bliss/Documents/Coder/Sails/brushfire/node_modules/machinepack-youtube/node_modules/machine/lib/intercept-exit-callbacks.js:98:20)
at ontimeout (timers.js:488:11)
at tryOnTimeout (timers.js:323:5)
at Timer.listOnTimeout (timers.js:283:5)   name: 'UsageError',   code: 'E_INVALID_NEW_RECORD',   details: 'Got an array, but expected

new record to be provided as a dictionary (plain JavaScript object).  
  Array usage is no longer supported as of Sails v1.0 / Waterline 0.13.  
  Instead, please explicitly call .createEach().' } 

How to work around this problem? 
It would seem like the code should work in a previous version of .create but now Array usage is no longer supported....
How to rewrite this code to work with the latest Sails version? 

A:

The create method of Waterline expects the parameter to be an object. 
According to the error you are getting, it seems that the foundVideos is an array of objects.  In that case, you need to use createEach which expects array of objects.  Like this:
  Video.createEach(foundVideos).fetch().exec(function(err, videoRecordsCreated){
    if(err){
      console.log('err', err);

      return cb(err);
    }
    console.log('videoRecordsCreated', videoRecordsCreated);
  }));

