title: mongoDB query to find the document in nested array
body: <pre><code>[{
    "username":"user1",
    "products":[
             {"productID":1,"itemCode":"CODE1"},
             {"productID":2,"itemCode":"CODE1"},
             {"productID":3,"itemCode":"CODE2"},
         ]
  },
  {
    "username":"user2",
    "products":[
             {"productID":1,"itemCode":"CODE1"},
             {"productID":2,"itemCode":"CODE2"},
         ]
  }]
  </code></pre>
  
  <p>I want to find all the "productID" of "products"  for "user1" such that "itemCode" for the product is "CODE1".</p>
  
  <p>What query in mongoDB should be written to do so?</p>