Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  77] [ 3]  / answers: 1 / hits: 35068  / 10 Years ago, wed, november 19, 2014, 12:00:00

Is possible to add multiple rows at once from array with sequelize.js? This is my code:



  var user = User.build({
email: req.body.email,
password: req.body.password,
userlevel: '3',
});

User
.find({ where: { email: req.body.email } })
.then(function(existingUser){

if (existingUser) {
return res.redirect('/staff');
}

user
.save()
.complete(function(err){
if (err) return next(err);
res.redirect('/staff');
});
}).catch(function(err){
return next(err);
});


Thanks for any advise!


More From » orm

 Answers
3
[#68761] Sunday, November 16, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
dexter

Total Points: 717
Total Questions: 98
Total Answers: 115

Location: Sudan
Member since Thu, May 7, 2020
4 Years ago
;