title: MongoDB subdocument query to limit elements
body: <p>Here's what my document looks like.</p>
  
  <pre><code>{
      ID: "XYZ",
      messages: [
          {
              ID: "AAA",
              text: "this is a message"
          },
          {
              ID: "BBB",
              text: "this is a message"
          },
          {
              ID: "CCC",
              text: "this is a message"
          },
          {
              ID: "DDD",
              text: "this is a message"
          },
          {
              ID: "EEE",
              text: "this is a message"
          },
          {
              ID: "FFF",
              text: "this is a message"
          },
          {
              ID: "GGG",
              text: "this is a message"
          }
      ]
  }
  </code></pre>
  
  <p>And I want to aggregate and get messages for example from <code>CCC</code> to <code>FFF</code></p>
  
  <pre><code>{
      ID: "XYZ",
      messages: [
          {
              ID: "CCC",
              text: "this is a message"
          },
          {
              ID: "DDD",
              text: "this is a message"
          },
          {
              ID: "EEE",
              text: "this is a message"
          },
          {
              ID: "FFF",
              text: "this is a message"
          }
  
      ]
  }
  </code></pre>
  
  <p>So how is this possible?</p>