I am understanding some basic CRUD operations on MongoDB, I am having difficulty in understanding why we use req.user before using a method inside the promise below -
Why can't we use return addToProduct() instead of req.user.AddToProduct()
exports.postCart = (req, res, next) => {
const prodId = req.body.productId;
Product.findById(prodId)
.then(product => {
return req.user.addToCart(product);
})
.then(result => {
console.log(result);
})