title: Update multiple fields in mongoose subdocuments using $push
body: <p>I have a conversation schema which will contain two users. I want to flag messages to be deleted from one user so the other recipient still able to read the message. </p>
  
  <p><strong>Schema</strong></p>
  
  <pre><code>// Messages Schema
  var messagesSchema = new Schema({
      from: {
          type: Schema.Types.ObjectId,
          required: true,
          ref: 'User',
      },
      content: {
          type: String,
          required: true,
          trim: true
      },
  
      deleted_by: [{
          type: Schema.Types.ObjectId,
          ref: 'User'
      }],
  
      read_by: [{
          type: Schema.Types.ObjectId,
          ref: 'User'
      }],
  
  }, {
      timestamps: true
  });
  
  // Conversation Schema
  var conversationsSchema = new Schema({
  
      recipients: [{
          type: Schema.Types.ObjectId,
          required: true,
          ref: 'User',
          index: true
      }],
  
      messages: [messagesSchema],
  
  }, {
      timestamps: true
  });
  </code></pre>
  
  <p>Now when I create a conversation between two users it will look like the following</p>
  
  <pre><code>[
    {
      "_id": "57bb6fed3d001f054e809175",
      "updatedAt": "2016-08-22T21:37:30.631Z",
      "createdAt": "2016-08-22T21:34:37.381Z",
      "__v": 2,
      "messages": [
        {
          "updatedAt": "2016-08-22T21:34:37.380Z",
          "createdAt": "2016-08-22T21:34:37.380Z",
          "from": "57b7448668d04d3035774b9a",
          "content": "Hello are you there?",
          "_id": "57bb6fed3d001f054e809176",
          "read_by": [],
          "deleted_by": []
        },
        {
          "updatedAt": "2016-08-22T21:34:58.060Z",
          "createdAt": "2016-08-22T21:34:58.060Z",
          "from": "57b7448668d04d3035774b9a",
          "content": "I miss you",
          "_id": "57bb70023d001f054e809177",
          "read_by": [],
          "deleted_by": []
        },
        {
          "updatedAt": "2016-08-22T21:37:30.631Z",
          "createdAt": "2016-08-22T21:37:30.631Z",
          "from": "57b7816b68d04d3035774b9b",
          "content": "Hey... Me too",
          "_id": "57bb709a3d001f054e809178",
          "read_by": [],
          "deleted_by": []
        }
      ],
      "recipients": [
        "57b7448668d04d3035774b9a",
        "57b7816b68d04d3035774b9b"
      ]
    }
  ]
  </code></pre>
  
  <p>Now when one of the users want to delete the conversation from his side I want to add the user id to the <code>deleted_by</code> array inside each message. </p>
  
  <p>I am trying to do something like this</p>
  
  <pre><code>Conversation.findOneAndUpdate({
      _id: conversation_id
  }, {
      $push: {
          'messages.deleted_by': req.loggedInUser._id
      }
  }, function(err, data) {
      if(err) return next(err);
      res.json(data);
  })
  </code></pre>
  
  <p><strong>Error Returned</strong></p>
  
  <pre><code>TypeError: Cannot read property '$isMongooseDocumentArray' of undefined
  </code></pre>
  
  <p>I tried to add the <code>$</code> sign and still getting the same error.</p>