29 lines
563 B
JavaScript
29 lines
563 B
JavaScript
db.getCollection('users').aggregate([
|
|
{ $match: { idapp: '7', username:'Emycapp' } },
|
|
{
|
|
$lookup: {
|
|
from: "naves",
|
|
as: "ingr",
|
|
let: { ind_order: '$ind_order' },
|
|
pipeline: [
|
|
{
|
|
$match: {
|
|
$expr: {
|
|
$and: [
|
|
{ $eq: ['$ind_order', '$$ind_order'] },
|
|
]
|
|
}
|
|
}
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
$replaceRoot: { newRoot: { $mergeObjects: [{ $arrayElemAt: ["$ingr", 0] }, "$$ROOT"] } }
|
|
},
|
|
{
|
|
$match: { made_gift: { $exists: true } }
|
|
}
|
|
|
|
])
|