title: Remove item in nested object mongoose
body: <p>I'm trying to remove items from an array with the use of mongoose, this is my code.</p>
  <pre><code>const { ids } = req.body;
    try {
      const order = await Order.findById(req.params.id).populate('user', 'name').exec();
      if (!order) {
        return res.status(404).json({ errors: [{ msg: 'Vous ne pouvez pas fermer une commande déjà fermée' }] });
      }
      order.status = 'Partial';
      if (ids) {
        for (let i = 0; i &lt; ids.length; i += 1) {
          const e = ids[i];
          // @ts-ignore
          order.products[e] = undefined;
        }
      }
      console.log(order);
      const changedOrder = await order.save();
      res.json(changedOrder);
    } catch (err) {
      console.log(err);
      res.status(500).json({ errors: [{ msg: 'Server Error' }] });
    }
  </code></pre>
  <p>When I log it to the console the item in updated object is removed but it doesn't save in MongoDB when using .save().</p>
  <p>When I was using delete order.products[e], it did the same thing.</p>
  <p>Is there a way to update it with findbyidandupdate instead of modifying it in the memory?</p>