title: Unable to update schema within schema after findOne
body: <p>Hey guys I'm trying to update my FoodSchema which is within my restaurant schema inside my POST request Here is my schema:</p>
  
  <pre><code>//Create food schema 
  const FoodSchema = new Schema ({
     nameOfFood: String,
     numOfVotes: Number,
  });
  
  //Create restaurant schema
  const RestaurantSchema = new Schema ({
      nameOfRest: String,
      favoriteFoods:[FoodSchema],
  });
  </code></pre>
  
  <p>I am trying to update the food schema in the else statement after it finds it finds the restaurant and while I am able to access the data within restdata inside the <code>.then</code> method, it does not push the new restaurant. The goal I'm trying to accomplish is that if it finds the restaurant, I update its Food Schema.  </p>
  
  <pre><code>router.post('/votes', function(req,res)
  {
  
      //Parse the data.
      var newString = toTitleCase(req.body.restaurant);
  
      Restaurant.findOne({nameOfRest:newString}).then(function(restdata)
      {
  
          //If can't find restaurant, redirect to vote page again.
          if(!restdata)
          {
              console.log("Undefined");
              res.redirect('/votes');
          }
          //Restaurant is found 
          //If the food can't be found create and push a new array with one vote.
          //If you can find the food, then just update and add a vote.
          else
          {
  
              if(restdata.favoriteFoods.length==0)
              {
                  restdata.favoriteFoods.push({nameOfFood:req.body.food,numOfVotes:1});
              }
              else
              {
                  restdata.favoriteFoods.numOfVotes++;
              }
          }
      });
  });
  </code></pre>
  
  <p>Even further I am testing this code:</p>
  
  <pre><code>restdata.favoriteFoods.push({nameOfFood:req.body.food,numOfVotes:1});
  </code></pre>
  
  <p>Yet when I attempt to push it, it does not work. I was thinking about using <code>findOneAndUpdate</code> yet I'm not sure if that's the best thing to do here. Any ideas? </p>