title: Mongoose embedded document updating
body: <p>I have a problem with embedded document update.</p>
  
  <p>My defined Schemas:</p>
  
  <pre><code>var Talk = new Schema({
      title: {
          type: String,
          required: true
      },
      content: {
          type: String,
          required: true
      },
      date: {
          type: Date,
          required: true
      },
      comments: {
          type: [Comments],
          required: false
      },
      vote: {
          type: [VoteOptions],
          required: false
      },
  });
  
  var VoteOptions = new Schema({
      option: {
          type: String,
          required: true
      },
      count: {
          type: Number,
          required: false
      }
  });
  </code></pre>
  
  <p>Now I would like to update <code>vote.count++</code>, with given <code>Talk</code> id and <code>VoteOption</code> id. I have the following function to do the job:</p>
  
  <pre><code>function makeVote(req, res) {
  
      Talk.findOne(req.params.id, function(err, talk) {
          for (var i = 0; i &lt; talk.vote.length; i++) {
              if (talk.vote[i]._id == req.body.vote) {
                  talk.vote[i].count++;
  
              }
          }
          talk.save(function(err) {
              if (err) {
                  req.flash('error', 'Error: ' + err);
                  res.send('false');
              } else {
                  res.send('true');
              }
          });
      });
  }
  </code></pre>
  
  <p>Everything executes, I get back the <code>res.send('true')</code>, but the value on count does not change.</p>
  
  <p>When I did some <code>console.log</code> I saw that it changed the value, but the <code>talk.save</code> just doesn't save it in db.</p>
  
  <p>Also I'm quite unhappy about the cycle just to find <code>_id</code> of embedded doc. In the mongoose documentation I read about <code>talk.vote.id(my_id)</code> but that gives me error of not having an <code>id</code> function.</p>