Nested object text search in mongoDB
<p>I am not sure how I am going to solve this problem:<br>
I want to search in a mongoDB collection and return only the nested objects that fits the search query (using text search on all of the fields).</p>

<p>All documents in the collection have this format:</p>

<pre><code>{
  arr: [
    {
      _id: 1,
      name: 'Random',
      description: 'Hello world'
    },
    {
      _id: 2,
      name: 'World',
      description: 'This is a random description'
    },
    {
      _id: 3,
      name: 'Random',
      description: 'Hi'
    }
  ]
}
</code></pre>

<p>In this case, if my search query is 'world', then this should be the result: </p>

<pre><code>[
  {
    _id: 1,
    name: 'Random',
    description: 'Hello world'
  },
  {
    _id: 2,
    name: 'World',
    description: 'This is a random description'
  },
  //... objects from other documents in the collection that fits the query
]
</code></pre>

<p>If this is not possible in mongoDB, are there any JavaScript libraries that can achieve this? Would greatly appreciate the help!</p>