title: How to update entire object in mongodb using mongoose
body: <p>i am trying to update the particular student details here based on the student id.I don't know how to update the entire student details using findById.
  I am able to get the updated values from the frontend and send it to the server but from server i can able to send the updated values to the mongoDB but there i don't know how to update. 
  Please help me out.</p>
  
  <p>this is my server code:</p>
  
  <pre><code>server.post('/update',urlencodedParser,function(req,res){
  var response={
    Id:req.body.Id,
    Fname : req.body.Fname,
    age:req.body.age,
    Lname : req.body.Lname,
    dob : req.body.dob,
    pob : req.body.pob,
    month : req.body.month,
    nation : req.body.nation,
    mothertongue : req.body.mothertongue,
    bloodgroup : req.body.bloodgroup,
    fatherfname : req.body.fatherfname,
    fatherlname : req.body.fatherlname,
    occupation : req.body.occupation,
    placeofwork : req.body.placeofwork,
    officaladd : req.body.officaladd,
    emailid : req.body.emailid,
    phoneno : req.body.phoneno,
    mobileno : req.body.mobileno,
    motherfname : req.body.motherfname,
    motherlname : req.body.motherlname,
    motheroccupation : req.body.motheroccupation,
    motherplaceofwork : req.body.motherplaceofwork,
    motherofficaladd : req.body.motherofficaladd,
    motheremailid : req.body.motheremailid,
    motherphoneno : req.body.motherphoneno,
    mothermobileno : req.body.mothermobileno,
    adress : req.body.adress,
    emergencyadress : req.body.emergencyadress,
    emergencyphone1 : req.body.emergencyphone1,
    emergencyphone2 : req.body.emergencyphone2,
    relationship1 : req.body.relationship1,
    relationship2 : req.body.relationship2
  
  }
  databaseInterface.updateStudent(response,  function(err, valss){
    if(err) res.send('ERROR!');
    console.log(valss);
    res.send(valss);
  })
  })
  </code></pre>
  
  <p>this is my mongoose code :</p>
  
  <pre><code>function updateStudent(response,callback) {
    console.log(response)
      User.findById(response.Id, function(err, studentcollection2) {
          if (err) return callback(err);
              studentcollection2 = response;
          return callback(null, studentcollection2);
           });
      }
  </code></pre>