title: Best way to store large lists in mongodb
body: <p>What is the best way to store large arrays/lists in mongodb without sacrificing query performance?</p>
  
  <p>I have a large collection (>1M records) which is composed of lists. The lists each have random lengths between 0 and >40k records. </p>
  
  <p>I never modify/reorder the list indices - I only add new items onto the end</p>
  
  <p>When accessing the data, I need to be able to search by index/fields within a given list. For instance, I might want to run searches like this:</p>
  
  <pre><code>myCollection.find({list: 'awesomeList', index: {$gt: 500}})
  myCollection.find({list: 'otherList', name: 'Karl'})
  </code></pre>
  
  <p>So far I've had a few ideas about a way forward:</p>
  
  <ol>
  <li>Store each list item as a document with an "index" member</li>
  <li>Store each list item as a document with a custom ObjectId to reflect the index</li>
  <li>Store list items on the parent item in a binary tree structure (???)</li>
  </ol>