title: Use mongoose to find by a nested documents properties
body: <p>I currently have a collection of documents that each contain arrays pointing at other documents within that collection. I need to query this collection for documents where the ones nested in arrays contain a certain property. I hope this will explain my request more clearly:</p>
  
  <pre><code>if doc.list1[0].prop = 'foo' or doc.list2[0].prop = 'foo' then select doc
  </code></pre>
  
  <p>I have tried using .find() like this but to no avail.</p>
  
  <pre><code>{
      'doc.list1': 'foo',
      $or: [
          { 'doc.list2': 'foo' }
      ]
  }
  </code></pre>
  
  <p>Am I on the right track? Because I don't think I am. This is the best I can gleam from the documentation.</p>
  
  <p><strong>Edit</strong></p>
  
  <p>Here is my actual query initialisation using the same layout as Thomas's suggestion.</p>
  
  <pre><code>var query = this.Word.find({
      $or: [
          { 'before.0.cleanWord': topic },
          { 'after.0.cleanWord': topic },
          { 'cleanWord': topic }
      ]
  });
  </code></pre>