title: Not able to fetch mongo result correctly for array inside a document
body: <pre><code>{  
     "_id":ObjectId("570404d3b4aefafb2d975e49"),
     "timeStamp":NumberLong(1459881168860),
     "activityMessages":null,
     "oldLocation":null,
     "changeType":"ContainerCreated",
     "userId":"naveen",
     "newLocation":"L1-500",
     "itemHistory":[  
        {  
           "userId":null,
           "timeStamp":null,
           "oldLocation":null,
           "newLocation":null,
           "changeType":"ItemAdded",
           "activityMessages":null,
           "itemNumber":325136,
           "purchCompanyId":1003,
           "poNum":"100",
           "oldQty":NumberLong(0),
           "newQty":NumberLong(100),
           "inventoryStatus":"Received"
        },
        {  
           "userId":null,
           "timeStamp":null,
           "oldLocation":null,
           "newLocation":null,
           "changeType":"ItemAdded",
           "activityMessages":null,
           "itemNumber":325136,
           "purchCompanyId":1003,
           "poNum":"100",
           "oldQty":NumberLong(0),
           "newQty":NumberLong(2000),
           "inventoryStatus":"Frozen"
        },
        {  
           "userId":null,
           "timeStamp":null,
           "oldLocation":null,
           "newLocation":null,
           "changeType":"ItemAdded",
           "activityMessages":null,
           "itemNumber":88888,
           "purchCompanyId":1003,
           "poNum":"101",
           "oldQty":NumberLong(0),
           "newQty":NumberLong(200),
           "inventoryStatus":"Claims"
        }
     }
  </code></pre>
  
  <p>This is my typical Mongo document. On querying for a given item number in a given timestamp range with the query:</p>
  
  <pre><code>{ "timeStamp" :  { "$gte" : 0 , "$lte" : 1459933945543} , "itemHistory.itemNumber" : 325136}
  </code></pre>
  
  <p>I am getting the correct response ! However while searching for the itemNumber 88888, I am not getting any response for the same query.</p>
  
  <pre><code>{ "timeStamp" :  { "$gte" : 0 , "$lte" : 1459933945543} , "itemHistory.itemNumber" : 88888}
  </code></pre>
  
  <p>The following query works just fine :</p>
  
  <pre><code>{ "timeStamp" : { "$gte" : 0 , "$lte" : 1459933945543} , "itemHistory" : {"$elemMatch":{"itemNumber":112}}} 
  </code></pre>
  
  <p>Response:</p>
  
  <pre><code>Fetched 0 records
  </code></pre>
  
  <p>This has made me wonder if only the first element of the array inside a document is being picked up while matching the query conditions. I have tried a bunch of other queries, nothing seems to be working. </p>
  
  <p>I need the entire document to be returned which contains the given itemNumber!</p>
  
  <p>TIA</p>