title: Querying array sub-document in mongoose
body: <p>I'm using MongoDB in a <code>Node.js</code> app with <code>mongoose</code>. 
  I have a collection in my DB, that can be described with the following schema:</p>
  
  <pre><code>{
    id: String,
    name: String,
    indicators: [{
      date: Date,
      value: Number
    }]
  }
  </code></pre>
  
  <p>where <code>id</code> is unique, and each document has a lot of <code>indicators</code> in it.</p>
  
  <p>I want to able to query the collection according to attributes of the <code>indicators</code> array. For example: sort the array by date or limit the amount of results in the array (possibly with an offset).</p>
  
  <p>How can I do that?</p>