title: Unable to remove element from Array in Mongoose
body: <p>I am trying to remove an element through its <code>_id</code> from an array model in mongoose. The same technique is working elsewhere in my code, but here it fails to remove the element. After hours of trying to change various parts of it, I am finally posting it here because maybe my lack of sleep is the main reason. Can someone find out what i am doing wrong? </p>
  
  <pre><code>ABC.findOne({
      'user': new ObjectId(req.decoded._id),
      'activity.ride': new ObjectId(id)
  }, {
      'activity.$': 1
  }, function(err, doc) {
  
      if (doc !== null) {
          for (var j = 0; j &lt; doc.activity.length; j++) {
              var request = JSON.parse(JSON.stringify(doc.activity[j]));
              doc.activity.remove(request._id);
              doc.save();
          }
      }
  });
  </code></pre>
  
  <p>This is the model: </p>
  
  <pre><code>var activityItem = mongoose.Schema({
      timestampValue: Number,
      xabc: String,
      full: Boolean,
      comp: Boolean
  });
  
  var ABC = mongoose.Schema({
      activity: [activityItem],
      user: {
          type: mongoose.Schema.ObjectId,
          ref: 'User'
      },
      username: String
  });
  </code></pre>