1

i m using passportjs nodejs and mongoose in server side to develop a web. i m trying to save using req.user.save(); it works properly. but when i m updating a field its showing an error tells no method save. here is mycode and error:

exports.save_user=function (req,res) {
  if(req.body.id==4)
  {
    var screen4=req.body.user_info;
    console.log(screen4);
    console.log(req.user.screen4[0]);
    req.user.screen4[0]=screen4[0];
    console.log(req.user.screen4);
  }

  req.user.save(function(err){
    if(err)
    {
       res.send(err);
    } 
    else
    {
      res.send('saved');
      //console.log(req.user);
    }

  });
}

if i dont use req.user.screen4[0]=screen4[0]; this saving creates no problems. thanx in advance


what's also wrong is that you are using the byte type with values higher than 255. Try changing to int16_t.

4

0 回答 0