Create Many Records with model.create()
Sometimes you need to create many instances of your models, e.g. when seeding a database with initial data. Model.create()
takes an array of objects like [{name: 'John', ...}, {...}, ...]
as the first argument, and saves them all in the db.
Modify the createManyPeople
function to create many people using Model.create()
with the argument arrayOfPeople
.
Note: You can reuse the model you instantiated in the previous exercise.
/** * * Your test output will go here * * */
Tests
- Waiting: 1. Creating many db items at once should succeed