title: MongoDB - How to unwrap nested json
body: <p>My documents in collection,</p>
  <pre><code>[
      {
          &quot;_id&quot;: {
              &quot;uuid&quot;: &quot;aaa&quot;,
              &quot;sectionId&quot;: &quot;1&quot;
          },
          &quot;name&quot;: &quot;tmp&quot;
      },
      {
          &quot;_id&quot;: {
              &quot;uuid&quot;: &quot;bbb&quot;,
              &quot;sectionId&quot;: &quot;2&quot;
          },
          &quot;name&quot;: &quot;tmp&quot;
      },
      {
          &quot;_id&quot;: {
              &quot;uuid&quot;: &quot;ccc&quot;,
              &quot;sectionId&quot;: &quot;3&quot;
          },
          &quot;name&quot;: &quot;tmp&quot;
      }
  ]
  
  </code></pre>
  <p>Need something like this in output:</p>
  <p>_id.uuid -&gt; slot_id</p>
  <p>_id.sectionId -&gt; id</p>
  <p>name -&gt; slot_name</p>
  <pre><code>[
      {
          &quot;slot_id&quot;: &quot;aaa&quot;,
          &quot;id&quot;: &quot;1&quot;,
          &quot;slot_name&quot;: &quot;tmp&quot;
      },
      {
          &quot;slot_id&quot;: &quot;bbb&quot;,
          &quot;id&quot;: &quot;2&quot;,
          &quot;slot_name&quot;: &quot;tmp&quot;
      },
      {
          &quot;slot_id&quot;: &quot;ccc&quot;,
          &quot;id&quot;: &quot;3&quot;,
          &quot;slot_name&quot;: &quot;tmp&quot;
      }
  ]
  </code></pre>
  <p>I have an ugly looking working in Java, but I am quite sure mongodb has a nice way of doing it..</p>
  <p>Please help!! Thanks in advance.</p>