title: Aggregation mongodb to display data on front-end
body: <p>I'm a new student to fullstack JavaScript development.  I'm currently working on a project that produces inventory management information from a food ordering interface.  The current process is that each item ordered is an object that is pushed into an array which represents the full order. </p>
  
  <p>Ex: It goes in as:</p>
  
  <pre><code>    {
      "_id" : ObjectId("5751e8c495251b62210242c2"),
      "newMenu" : [
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 105,
                      "price" : 11.25,
                      "desc" : "Slow cooked ribs that slide right off the bone. Covered in Jim's special BBQ sauce.",
                      "item" : "Baby Back Ribs"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 107,
                      "price" : 7.85,
                      "desc" : "Delicious pasta stuffed with spinach and ricotta cheese.",
                      "item" : "Raph's Ravioli"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 200,
                      "price" : 1.5,
                      "desc" : "Perpsi, Croke, Mountain Mist, Nurse Pepper, or Spreete.",
                      "item" : "Fountain Drink"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 204,
                      "price" : 5.25,
                      "desc" : "A delicious brown ale from the UK.",
                      "item" : "Oldcastle"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 206,
                      "price" : 4.5,
                      "desc" : "American pale lager.",
                      "item" : "Dudweiser"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 207,
                      "price" : 4.5,
                      "desc" : "Light American pale lager.",
                      "item" : "Dud Light"
              },
              {
                      "checked" : true,
                      "amount" : 1,
                      "stockNum" : 101,
                      "price" : 12.8,
                      "desc" : "Thin crusted pizza with your choice of toppings.",
                      "item" : "New York Pizza"
              }
      ],
      "__v" : 0
   }
  </code></pre>
  
  <p>I need to get the amount of each item ordered based off stock number or <code>stockNum</code> and return that value.  </p>
  
  <p>So far I've tried: </p>
  
  <p><code>db.menus.aggregate([ { $match: { stockNum: "208" } }, {$group: {_id: "$cust_id", total: {$sum: "$amount"}}}, {$sort: {total: -1}}])</code></p>
  
  <p>While I get no errors, I also get no output.</p>
  
  <p>Thank you!</p>