We have a MongoDB collection with the following schema.
    Sales {
       salesID:"SO-0002"
       dispatches: [
          {
           "dispatchNo" : "SO-0002/dispatch/1",
        "date" : "2014-05-31T18:30:00.000Z",
        "location" : "l1",
        "items": [{
                     //itemDetails
                 }]
          },
          {
           "dispatchNo" : "SO-0002/dispatch/2",
        "date" : "2014-05-31T18:30:00.000Z",
        "location" : "l2",
        "items": [{
                     //itemDetails
                 }]
          }
       ]
    }
Upon execution of the following query:
db.sales.find({salesOrderNo:"SO-0002",'dispatches.dispatchNo':"SO-0002/dispatch/1"}).pretty()
We expect to get only the details of the dispatch 1, but we are still getting the details of all the dispatches.
Are we missing something?
Thanks.
 
    