title: Aggregation using Project and Slice, mongodb
body: <p>I've seen similar questions but far to complex for a newbie like myself. Plus none of the answers offered a syntax break down. </p>
  
  <p>My database:</p>
  
  <pre><code>    name :"Kim"
      points: [ 
         { category:"Purchase",
           points: -50},
         { category: "Wage",
           points : 275},
         { category: "Purchase",
           points: -40}
      ]
  
      name :"Meghan"
      points: [ 
         { category:"Contest",
           points: 130},
         { category: "Purchase",
           points : -25},
         { category: "Games",
           points : 50}
       ]
      ]
  </code></pre>
  
  <p>So in the mongo shell I'm trying to get it find every points.category that equals "Purchase" but only return to me the last one. I attempted to achieve this by using aggregate, $project and $slice. My issue is that I don't understand the syntax well enough to know whether $slice goes inside $project or outside separated by a comma. I understand the syntax when I use $project by itself or $slice by itself but I have no clue how to use all these things together to something magical. If someone could help me solve my problem and explain how to combine all these things properly together, I'd be forever indebted. I've read over the docs but nothing showed me how to use everything all at once.</p>
  
  <p>I want to search the student who's name is Kim points to find the last Purchase she made. The result I want is
         [{points:-40}]</p>