title: Use $lookup after $group
body: <p>I have two tables: userinfo and challenge</p>
  
  <pre><code>**userinfo**
  username:'aa',nickname:'bb',...
  
  **challenge**
  username:'aa',win:1,loss:0,...
  username:'aa',win:0,loss:1,...
  username:'bb',win:1,loss:0,...
  username:'bb',win:0,loss:1,...
  </code></pre>
  
  <p>I am trying to perform a mongodb aggregate to group on username located in the lookup object and sum based upon items located in <code>challenge</code>.
  my code:</p>
  
  <pre><code>db.challenge.aggregate([
  {$group : "$username",win: { $sum: "$win" }},loss: { $sum: "$loss" }}},
  {$lookup: {from: "userinfo", localField: "username", foreignField: "username", as: "userinfo"}} ]);
  </code></pre>
  
  <p>But in the results userinfo returns an empty array:</p>
  
  <pre><code>{ "_id" : "aa", win:12, loss:10,"userinfo" : [ ] }
  { "_id" : "bb", win:2, loss:5,"userinfo" : [ ] }
  </code></pre>
  
  <p>mongo version is 3.4, so where do i make wrong?</p>