title: How to save deletion in a deeply nested MongoDB document
body: <p>I am new to MongoDB and I am using MongoDB shell to perform the operations.
  I am working to remove the array named Process from all the Items, but it seems that I do not grasp the remove concept correctly.
  The documents we use are deeply nested - we do not know how many items there are, or how deep the level of nesting.
  <br>What I tried so far is to use recursion to iterate through the items:</p>
  <pre><code>
  
      function removeAllProcessFields(docItems)
      {
          if(Array.isArray(docItems))
          {
              docItems.forEach(function(item)
                  {
                     print("idItem: "+item._id);
                     if(item.Process == null)
                     {
                        print("Process null");
                     }
                     else
                     {
                        $unset: { Process: ""}
                     }
                     removeAllProcessFields(item.Items);
              })
          }
      }
      
      var docs = db.getCollection('MyCollection').find({})
      docs.forEach(function(doc)
      {
          print("idDoc: "+doc._id);
          removeAllProcessFields(doc.Items);
      })
  
  </code></pre>
  <p>But I have difficulties on using unset properly to save the operation.
  <br>An example document would be:</p>
  <pre><code>
  
      {
          "_id": "622226d319517e83e8ed6151",
          "Name": "test1",
          "Description": "",
          "Items": [{
              "_id": "622226d319517e83e8ed614e",
              "Name": "test-item",
              "Description": "",
              "Process": [{
                  "Name": "Step1"
              }, {
                  "Name": "Step2"
              }],
              "Items": [{
                      "_id": "622226d319517e83e8ed614f",
                      "Name": "test-subItem1",
                      "Description": "",
                      "Process": [{
                          "Name": "StepSub1"
                      }, {
                          "Name": "StepSub2"
                      }, {
                          "Name": "StepSub3"
                      }],
                      "Items": []
                  },
                  {
                      "_id": "622226d319517e83e8ed6150",
                      "Name": "test-subItem2",
                      "Description": "",
                      "Process": [{
                          "Name": "StepSub4"
                      }, {
                          "Name": "StepSub5"
                      }, {
                          "Name": "StepSub6"
                      }],
                      "Items": []
                  }
      
              ]
          }]
      }
  
  </code></pre>
  <p>What I hope to achieve would be:</p>
  <pre><code>
  
      {
          "_id": "622226d319517e83e8ed6151",
          "Name": "test1",
          "Description": "",
          "Items": [{
              "_id": "622226d319517e83e8ed614e",
              "Name": "test-item",
              "Description": "",
              "Items": [{
                      "_id": "622226d319517e83e8ed614f",
                      "Name": "test-subItem1",
                      "Description": "",
                      "Items": []
                  },
                  {
                      "_id": "622226d319517e83e8ed6150",
                      "Name": "test-subItem2",
                      "Description": "",
                      "Items": []
                  }
      
              ]
          }]
      }
  
  </code></pre>