- Modifiche a ProductInfo... Continua
This commit is contained in:
@@ -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'
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user