#```cartSchema pre find function next

1 messages · Page 1 of 1 (latest)

fallow sparrow
#

Comparte porfa, una captura de un documento de tu colección

remote reef
#

aca esta el carrito

#
    "carrito": [
        {
            "_id": "65020f201e788aefe3b6980a",
            "products": [
                {
                    "_id": {
                        "_id": "64f2465cb788d50b33214697",
                        "title": "Producto Cambiado 5",
                        "description": "Este es un producto prueba fue modificado",
                        "price": 400,
                        "stock": 50,
                        "code": "FFF666",
                        "category": "Si",
                        "status": true,
                        "__v": 0
                    },
                    "quantity": 2
                }
            ],
            "__v": 0
        },
        {
            "_id": "65020f411e788aefe3b69810",
            "products": [
                {
                    "_id": {
                        "_id": "64f2465cb788d50b33214697",
                        "title": "Producto Cambiado 5",
                        "description": "Este es un producto prueba fue modificado",
                        "price": 400,
                        "stock": 50,
                        "code": "FFF666",
                        "category": "Si",
                        "status": true,
                        "__v": 0
                    },
                    "quantity": 2
                },
                {
                    "_id": {
                        "_id": "64f24671b788d50b3321469b",
                        "title": "Producto Prueba 1",
                        "description": "Este es un producto prueba",
                        "price": 400,
                        "stock": 25,
                        "code": "AAA002",
                        "category": "Cinturones",
                        "status": true,
                        "__v": 0
                    },
                    "quantity": 1
                }
            ],
            "__v": 0
        }
    ]
}```
#

y el otro algunos productos

fallow sparrow
#

@remote reef intenta hacerlo no dentro del middleware pre('find', sino en el find:

cartModel.findById(id).populate('products._id')
remote reef
#

esaaa

#

ahora si

#

pq no andaba entonces

#

yo tengo esto y esto.... tambien tengo que cambiar algo?

fallow sparrow
remote reef
#

Perfecto