Help: express builds the station, adds records in mongodb, and does not enter save callback.

  node.js, question

Recently, when I was studying express, I wrote a movie website demo. When I met with a little problem, I couldn’t figure it out and asked the great god for advice.

Problem description:
When adding new records, the form is completed, click Import, and the request is sent out, but it will always request and will not enter the save callback, and there will be no error (here is the code block of else in if)

app.post('/admin/movie/new', function (res, req) {
 var id = res.body.movie._id;
 var movieObj = res.body.movie;
 var _movie;
 if (id !  == 'undefined') {
 Movie.findById(id, function (err, movie) {
 if (err) {
 console.log(err);
 bracket
 
 _movie = _.extend(movie, movieObj);
 _movie.save(function (err, movie) {
 if (err) {
 console.log(err);
 bracket
 
 Res.redirect('/movie/' plus movie._id);
 });
 });
 } else {
 _movie = new Movie({
 doctor: movieObj.doctor,
 title: movieObj.title,
 country: movieObj.country,
 language: movieObj.language,
 year: movieObj.year,
 poster: movieObj.poster,
 summary: movieObj.summary,
 flash: movieObj.flash
 });
 
 _movie.save(function (err, movie) {
 if (err) {
 console.log(err);
 bracket
 
 Res.redirect('/movie/' plus movie._id);
 });
 bracket
 });

Project address:Https://github.com/xjchenhao/Learn/tree/master/nodejs/ percentage E7 percentage AB percentage 99 percentage E7 percentage 82 percentage B9 percentage E5 percentage BB percentage BA percentage E8 percentage AE percentage BE/imooc

图片描述

YesRes.redirect('/movie/' plus movie._id);It is wrong, it should be req .. excuse me?