Scontistica- Parte 1
This commit is contained in:
@@ -6,6 +6,7 @@ const tools = require('../tools/general');
|
||||
const Producer = require('../models/producer');
|
||||
const Storehouse = require('../models/storehouse');
|
||||
const Provider = require('../models/provider');
|
||||
const Scontistica = require('../models/scontistica');
|
||||
|
||||
const shared_consts = require('../tools/shared_nodejs');
|
||||
|
||||
@@ -33,6 +34,9 @@ const productSchema = new Schema({
|
||||
idStorehouses: [
|
||||
{ type: Schema.Types.ObjectId, ref: 'Storehouse' }
|
||||
],
|
||||
idScontisticas: [
|
||||
{ type: Schema.Types.ObjectId, ref: 'Scontistica' }
|
||||
],
|
||||
idProvider: { type: Schema.Types.ObjectId, ref: 'Provider' },
|
||||
code: {
|
||||
type: String,
|
||||
@@ -214,7 +218,12 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
as: 'producer'
|
||||
}
|
||||
},
|
||||
{ $unwind: '$producer' },
|
||||
{
|
||||
$unwind: {
|
||||
path: '$producer',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'providers',
|
||||
@@ -223,7 +232,26 @@ module.exports.findAllIdApp = async function (idapp, code, id) {
|
||||
as: 'provider'
|
||||
}
|
||||
},
|
||||
{ $unwind: '$provider' },
|
||||
{
|
||||
$unwind: {
|
||||
path: '$provider',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'scontisticas',
|
||||
localField: 'idScontisticas',
|
||||
foreignField: '_id',
|
||||
as: 'scontistica'
|
||||
}
|
||||
},
|
||||
{
|
||||
$unwind: {
|
||||
path: '$scontistica',
|
||||
preserveNullAndEmptyArrays: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
$lookup: {
|
||||
from: 'storehouses',
|
||||
|
||||
Reference in New Issue
Block a user