title: MongoDB: aggregation, array of objects to string value
body: <p>My question is pretty similar to: <a href="https://stackoverflow.com/questions/38377582/mongodb-aggregation-join-array-of-strings-to-single-string">MongoDB Aggregation join array of strings to single string</a>, but instead of pure Array, like: <code>['Batman', 'Robin']</code> I have Array of objects:</p>
  <pre><code>_id: 1,
  field_value: [
    {
      _id: 2,
      name: &quot;Batman&quot;
    },
    {
      _id: 3,
      name: &quot;Robin&quot;
    }
  ]
  
  </code></pre>
  <p>I am trying to use <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/reduce/#exp._S_reduce" rel="nofollow noreferrer"><code>$reduce</code></a> but got error instead.</p>
  <p>I want to receive the following result:</p>
  <pre><code>  _id: 1,
    field_value: &quot;Batman, Robin&quot; /** &lt;= String value */
  </code></pre>
  <p>or at least array of property values:</p>
  <pre><code>  _id: 1,
    field_value: [&quot;Batman&quot;, &quot;Robin&quot;] /** &lt;= Array of strings (name property) */
  </code></pre>
  <p>My <a href="https://mongoplayground.net/p/TTT2zAd0mX5" rel="nofollow noreferrer">MongoPlayground data example</a></p>