title: MongoDB - return subdocument of large parent
body: <p>I have a collection of large documents (between ~200 - ~500 kb each). </p>
  
  <p>Each document contains an array of subdocuments. Within each subdocujent, there is an array i need to search through.</p>
  
  <p>I need to build an interface that enables me to fetch a single subdocument. </p>
  
  <p>Considering the fact that i can not refactor the document model and do not know in which parent document the target lives, what would be the smartest and fastest way to achieve this?</p>
  
  <p>I would like to give you an example of what I have tried, but I am even struggling with the basic concept of "How do I search each array of subdocuments for what I need", so excuse the lack of such.</p>
  
  <p>A parent document looks like this:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
  "name":"Foobar",
  "subs":[
      {           
          "imageName":"name",
          "foreignNames":[
              {
                  // This is the field I need to search through
              }
          ]
      }
  ]
  }
  </code></pre>