sql >> Base de Datos >  >> NoSQL >> MongoDB

Eliminar objeto con ObjectId de matriz en Mongoose/MongoDB

Tu problema está aquí en la función de actualización

User.update(
        {'_id':user_id}, // you not need to use ObjectId here
        { $pull: { '_carts': { _id: cart_id }}},
        function(err,result){
    // can you give here the output of console.log(result);
   }
    )
    User.save();