title: MongoDB querying for Embeded Document
body: <p>I have a mongo document which has structure like</p>
  
  <pre><code>{
  "_id" : "THIS_IS_A_DHP_USER_ID+2014-11-26",
  "_class" : "weight",
  "items" : [
      {
          "dateTime" : ISODate("2014-11-26T08:08:38.716Z"),
          "value" : 98.5
      },
      {
          "dateTime" : ISODate("2014-11-26T08:18:38.716Z"),
          "value" : 95.5
      },
      {
          "dateTime" : ISODate("2014-11-26T08:28:38.663Z"),
          "value" : 90.5
      }
  ],
  "source" : "MANUAL",
  "to" : ISODate("2014-11-26T08:08:38.716Z"),
  "from" : ISODate("2014-11-26T08:08:38.716Z"),
  "userId" : "THIS_IS_A_DHP_USER_ID",
  "createdDate" : ISODate("2014-11-26T08:38:38.776Z")
  }
  {
  "_id" : "THIS_IS_A_DHP_USER_ID+2014-11-25",
  "_class" : "weight",
  "items" : [
      {
          "dateTime" : ISODate("2014-11-25T08:08:38.716Z"),
          "value" : 198.5
      },
      {
          "dateTime" : ISODate("2014-11-25T08:18:38.716Z"),
          "value" : 195.5
      },
      {
          "dateTime" : ISODate("2014-11-25T08:28:38.716Z"),
          "value" : 190.5
      }
  ],
  "source" : "MANUAL",
  "to" : ISODate("2014-11-25T08:08:38.716Z"),
  "from" : ISODate("2014-11-25T08:08:38.716Z"),
  "userId" : "THIS_IS_A_DHP_USER_ID",
  "createdDate" : ISODate("2014-11-26T08:38:38.893Z")
  }
  </code></pre>
  
  <p>The query that want to fire on this document structure, is for finding documents for a particular user id, unwinding the the embedded array and getting the objects that fall between a particular date range. </p>
  
  <p>Can an aggregation be created for such a query or else is this need be solved using map-reduce kind of querying.</p>