Tengo la respuesta Cast to error en JSON al agregar los detalles del producto en & al agregar la categoría que muestra Error.
const mangosta = require("mangosta"); const { ObjectId } = mangosta.Esquema;
{
categoría: { tipo: ObjectId, ref: "Categoría", },
};
Excepto categoría Cada detalle se agrega en la tabla mongodb
Deberías probar mongoose.SchemaTypes.ObjectId
@Prop({ type: mongoose.SchemaTypes.ObjectId, ref: 'ExercisePlan' }) category: string;
Y si está tratando de agregar con _id, entonces debería intentar
$match: { category: new Types.ObjectId(inputId), },