title: Aggregation operation to modify the key of a property from a subdocument of documents
body: <p>I have in mongo db a collection with documents like this:</p>
  
  <pre><code>{
      "prop1": "val1",
      "prop2": {
          "prop21": {
              "toBeChanged1_xyz": "val2",
              "toBeChanged2_zyx": "val3",
          },
          "prop22": {
              "whatever": "something"
          }
      }
  }
  </code></pre>
  
  <p>Trying to create aggregation operation in Java Spring to remove from the keys of <code>prop21</code>'s properties the substring after <code>_</code>. This if what I need to have:</p>
  
  <pre><code>{
      "prop1": "val1",
      "prop2": {
          "prop21": {
              "toBeChanged1": "val2",
              "toBeChanged2": "val3",
          },
          "prop22": {
              "whatever": "something"
          }
      }
  }
  </code></pre>
  
  <p>Tried something like this:</p>
  
  <pre><code>List&lt;AggregationOperation&gt; operations = new ArrayList&lt;AggregationOperation&gt;();
          operations.add( Aggregation.project( "code" ).and( "code" ).minus( "_"+"$entityType" ).as( "newId" ));
  </code></pre>
  
  <p>It didn't worked, of course. I have no idea how can it be done or can it be done easier in other ways.</p>