title: Division in JavaScript of two fields
body: <p>I'm pretty new to javascript. I've been following a tutorial on how to create a e-commerce website. In it, you're shown how to create a dashboard, which shows data about the website. Some of the things it lists are the number of orders (<code>numOrders</code>) and the total number of sales (<code>totalSales</code>). I would like to calculate the average number of sales (<code>averageSales</code>). However, I am having some difficulty. I would really appreciate any help or guidance.</p>
  <pre><code>   orderRouter.get(
      '/summary',
      isAuth,
      isAdmin,
      expressAsyncHandler(async (req, res) =&gt; {
        const orders = await Order.aggregate([
          {
            $group: {
              _id: null,
              numOrders: { $sum: 1 },
              totalSales: { $sum: '$totalPrice' },
              averageSale: { $sum: '$totalPrice'/numOrders },
            },
          },
        ]);
        const users = await User.aggregate([
          {
            $group: {
              _id: null,
              numUsers: { $sum: 1 },
            },
          },
        ]);
        const dailyOrders = await Order.aggregate([
          {
            $group: {
              _id: { $dateToString: { format: '%Y-%m-%d', date: '$createdAt' } },
              orders: { $sum: 1 },
              sales: { $sum: '$totalPrice' },
            },
          },
          { $sort: { _id: 1 } },
        ]);
        const productCategories = await Product.aggregate([
          {
            $group: {
              _id: '$category',
              count: { $sum: 1 },
            },
          },
        ]);
        res.send({ users, orders, dailyOrders, productCategories });
      })
    );
  </code></pre>