title: spring query embedded document of arrays
body: <p>I am trying to query on id of embedded array of documents without any success. Would be great to know how to query array of embedded documents using its 'id'.</p>
  
  <p>Below is my collection named sp</p>
  
  <pre><code>{ "_id":ObjectId("54bd949a44ae90d7e1473581"),"orgName":"org name","towns":[{"_id":ObjectId("54bd7829104d630153f66082"),"status":"SUBMITTED","contact":{"name":"con name","email":"con@email.com","phone":"34567890123"}}]} 
  { "_id":ObjectId("54bd94ac44ae90d7e1473582"),"orgName":"sp3 org name","towns":[{"_id":ObjectId("54bd7829104d630153f66082"),"status":"SUBMITTED","contact":{"name":"sp3 contact name","email":"sp3con@email.com","phone":"45678903"}}]}
  { "_id":ObjectId("54bea67c44ae36e60e584d46"),"orgName":"org name","towns":[{"_id":ObjectId("54bd7829104d630153f66082"),"status":"SUBMITTED","contact":{"name":"con name","email":"con@email.com","phone":"34567890123"}}]}
  </code></pre>
  
  <p>The below queries return null. I expect it to return all the documents.</p>
  
  <pre><code>db.sp.find({'towns.id':{$in:['54bd7829104d630153f66082']}})
  db.sp.find({'towns.id':{$in:[ObjectId("54bd7829104d630153f66082")]}})
  </code></pre>
  
  <p>The below query returns all the three documents</p>
  
  <pre><code>db.sp.find({'towns.status':{$in:['SUBMITTED']}})
  </code></pre>