subcatprod
This commit is contained in:
@@ -37,6 +37,7 @@ const productInfoSchema = new Schema({
|
||||
type: String,
|
||||
},
|
||||
idCatProds: [{ type: Schema.Types.ObjectId, ref: 'CatProd' }],
|
||||
idSubCatProds: [{ type: Schema.Types.ObjectId, ref: 'SubCatProd' }],
|
||||
color: {
|
||||
type: String
|
||||
},
|
||||
@@ -131,6 +132,14 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
as: 'catprods'
|
||||
}
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'subcatprods',
|
||||
localField: 'idSubCatProds',
|
||||
foreignField: '_id',
|
||||
as: 'subcatprods'
|
||||
}
|
||||
},
|
||||
{
|
||||
$sort: {
|
||||
name: 1 // 1 for ascending order, -1 for descending order
|
||||
|
||||
Reference in New Issue
Block a user