title: MongoDB Why this error : can't append to array using string field name: comments
body: <p>I have a DB structure like below:</p>
  
  <pre><code>{
      "_id" : 1,
      "comments" : [
          {
              "_id" : 2,
              "content" : "xxx"
          }
      ]
  }
  </code></pre>
  
  <p>I update a new subdocument in the comments feild. It is OK.</p>
  
  <pre><code>db.test.update(
                 {"_id" : 1, "comments._id" : 2},
                 {$push : {"comments.$.comments" : {_id : 3, content:"xxx"}}}
  )
  </code></pre>
  
  <p>after that the DB structure:</p>
  
  <pre><code>{
      "_id" : 1,
      "comments" : [
          {
              "_id" : 2,
                      "comments" : [
                              {
                                      "id" : 3,
                                      "content" : "xxx"
                              }
                      ],
              "content" : "xxx"
          }
      ]
  }
  </code></pre>
  
  <p>But when I update a new subdocument in the comment field that _id is 3, There is a error:</p>
  
  <pre><code>db.test.update(  
                 {"_id" : 1, "comments.comments.id" : 3},   
                 {$push : {"comments.comments.$.comments" : {id : 4, content:"xxx"}}}  
  )
  </code></pre>
  
  <p>error message:</p>
  
  <blockquote>
    <p>can't append to array using string field name: comments</p>
  </blockquote>