title: How to update mongoDB from post()
body: <p>I am creating a MEAN Stack application. My post function is as follows:</p>
  
  <pre><code>app.post('/updateGroup/:id', function(req, res) {
   var id = req.params.id; // = mongoDB ObjectID ie: "55616e2a37e8728266ceac6"
   var vals = {};
  
   vals['hostName'] = req.body.hostName // = a String ie, "Steve"
                                        // this is a different name value than the
                                        // current hostName key that is in
                                        // the groupList db
  
   db.groupList.update(
      {"_id": id},
      {$set : vals},
      function(err, result) {
          if (err) {
              console.log(err);
          }
          else {
              console.log(result);
          }
      }
   );
  });
  </code></pre>
  
  <p>When I access this function in my front-end Angular code my</p>
  
  <pre><code>console.log(result);
  </code></pre>
  
  <p>Comes out as:</p>
  
  <pre><code>{ ok: true, n: 0, updatedExisting: true }
  </code></pre>
  
  <p>But I should see n: 1 to indicate there was an update? Why is my Node application not updating my mongoDB key:value pair?</p>
  
  <p>Is there something about db.collection.update() that I'm missing?</p>