Sailsjs update db with not equal id

  //check existing movie

if (req.body.movieName && req.body.year) {

let existMovie = await Movie.find({
where: {
id: { '!=': movieId },
movieName: req.body.movieName,
year: req.body.year
},
});
console.log('exit movie', existMovie)

if (existMovie.length > 0) {
return res.status(400).json({
success: false,
message: `This movie is already exist`
});
}
}

Post a Comment

0 Comments