title: Is it possible to convert the below collection to array as shown in MongoDB?
body: <p>Currently have generated the below result by dynamic key and value using <code>$arrayToObject</code> in mongodb.</p>
  <pre><code>[
    {
      &quot;ACCOUNT1&quot;: &quot;test1&quot;
    },
    {
      &quot;ACCOUNT2&quot;: &quot;test2&quot;
    },
    {
      &quot;ACCOUNT3&quot;: &quot;test3&quot;
    }
  ]
  </code></pre>
  <p>Is it possible to convert the above collection as shown below in mongodb</p>
  <pre><code>{
     &quot;ACCOUNT1&quot;: &quot;test1&quot;,
     &quot;ACCOUNT2&quot;: &quot;test2&quot;,
     &quot;ACCOUNT3&quot;: &quot;test3&quot;
  }
  </code></pre>