How to seed dummy data to a mongoose database when user password confirmation is in place
You are getting this error because you created a validation that require you to supply passwordConfirmation
that match the password
on the creation process.
You can live with that by adding the passwordConfirmation
field to your seed data:
User.create([{ username: 'dan123', email: 'dan@dan.com', postcode: 'SE270JF', password: '123' passwordConfirmation: '123',}, { username: 'ben123', email: 'ben@ben.com', postcode: 'SE191SB', password: '123', passwordConfirmation: '123',}])