- Modifiche a ProductInfo... Continua

This commit is contained in:
Surya Paolo
2025-08-29 23:34:08 +02:00
parent 2ee710b748
commit fcbc64cea8
24 changed files with 1006 additions and 1010 deletions

View File

@@ -62,13 +62,13 @@ CatProdSchema.statics.findAllIdApp = async function (idapp) {
return await CatProd.find(myfind).sort({ name: 1 }).lean();
};
CatProdSchema.statics.updateCatDeleteEmpty = async function (idapp) {
/*CatProdSchema.statics.updateCatDeleteEmpty = async function (idapp) {
try {
const toDelete = await CatProd.aggregate([
{ $match: { idapp } },
{
$lookup: {
from: 'productinfos',
from: 'products',
localField: '_id',
foreignField: 'idCatProds',
as: 'products'
@@ -99,7 +99,7 @@ CatProdSchema.statics.updateCatDeleteEmpty = async function (idapp) {
return error;
}
};
};*/
CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp, updatedata) {
try {
@@ -108,9 +108,9 @@ CatProdSchema.statics.getCatProdWithTitleCount = async function (idapp, updateda
{ $match: { idapp } },
{
$lookup: {
from: 'productinfos', // Nome della tua collezione productInfo
from: 'products', // Nome della tua collezione productInfo
localField: '_id',
foreignField: 'idCatProds',
foreignField: 'productInfo.idCatProds',
as: 'products'
}
},