title: How to update array in MongoDB to Document object
body: <pre><code>db.comments.find().pretty()
  {
      "_id" : ObjectId("5e0dce535dbc47b0d8c9f23e"),
      "create" : 1577963091106,
      "update" : 1577963091106,
      "post_id" : 1,
      "user" : {
          "user_id" : "ccchhh1",
          "loginType" : "kakao",
          "user_profile_img" : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBhaNckqtbF2gR0kMvWGhwe7ad4BvVAnAcHQqhgiIzp9mXSPXv4Q&amp;s",
          "nick_name" : "test"
      },
      "comment" : "test",
      "children" : [
          {
              "parent" : ObjectId("5e0dce535dbc47b0d8c9f23e"),
              "create" : 1577963694219,
              "update" : 1577963694219,
              "post_id" : 1,
              "user" : {
                  "user_id" : "ccchhh1",
                  "loginType" : "kakao",
                  "user_profile_img" : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBhaNckqtbF2gR0kMvWGhwe7ad4BvVAnAcHQqhgiIzp9mXSPXv4Q&amp;s",
                  "nick_name" : "test"
              },
              "comment" : "test"
          }
      ]
  }
  </code></pre>
  
  <p>I want to update the document to document children with an id as the key value. However, update does not create _id. What should I do?</p>
  
  <p>The result I want is</p>
  
  <pre><code>db.comments.find().pretty()
  {
      "_id" : ObjectId("5e0dce535dbc47b0d8c9f23e"),
      "create" : 1577963091106,
      "update" : 1577963091106,
      "post_id" : 1,
      "user" : {
          "user_id" : "ccchhh1",
          "loginType" : "kakao",
          "user_profile_img" : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBhaNckqtbF2gR0kMvWGhwe7ad4BvVAnAcHQqhgiIzp9mXSPXv4Q&amp;s",
          "nick_name" : "test"
      },
      "comment" : "test",
      "children" : [
          {
              "_id" : ObjectId("---"),------&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; !!
              "parent" : ObjectId("5e0dce535dbc47b0d8c9f23e"),
              "create" : 1577963694219,
              "update" : 1577963694219,
              "post_id" : 1,
              "user" : {
                  "user_id" : "ccchhh1",
                  "loginType" : "kakao",
                  "user_profile_img" : "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTBhaNckqtbF2gR0kMvWGhwe7ad4BvVAnAcHQqhgiIzp9mXSPXv4Q&amp;s",
                  "nick_name" : "test"
              },
              "comment" : "test"
          }
      ]
  }
  </code></pre>
  
  <p>I wish the object that goes into children also had a _id value. I tried various things to find a way, but failed. What should I do? Help me</p>