Mongodb embedded document - aggregation query
<p>I have got the below documents in Mongo database:</p>

<pre><code>db.totaldemands.insert({ "data" : "UKToChina", "demandPerCountry" : 
 { "from" : "UK" , to: "China" , 
   "demandPerItem" : [ { "item" : "apples" , "demand" : 200 }, 
   { "item" : "plums" , "demand" : 100 }
] } });

db.totaldemands.insert({ "data" : "UKToSingapore", 
"demandPerCountry" : { "from" : "UK" , to: "Singapore" , 
"demandPerItem" : [ { "item" : "apples" , "demand" : 100 }, 
  { "item" : "plums" , "demand" : 50 }
] } });
</code></pre>

<p>I need to write a query to find the count of apples exported from UK to any country.</p>

<p>I have tried the following query:</p>

<pre><code>db.totaldemands.aggregate(
{ $match : { "demandPerCountry.from" : "UK" ,  
  "demandPerCountry.demandPerItem.item" : "apples" } },
  { $unwind : "$demandPerCountry.demandPerItem" },
  { $group : { "_id" : "$demandPerCountry.demandPerItem.item", 
  "total" : { $sum : "$demandPerCountry.demandPerItem.demand" 
  } } }
);
</code></pre>

<p>But it gives me the output with both apples and plums like below:</p>

<pre><code>{ "_id" : "apples", "total" : 300 }
{ "_id" : "plums", "total" : 150 }
</code></pre>

<p>But, my expected output is:</p>

<pre><code> { "_id" : "apples", "total" : 300 }
</code></pre>

<p><strong>So, How can I modify the above query to return only the count of apples exported from UK ? 
Also, is there any other better way to achieve the output without unwinding ?</strong> </p>