const def = await Defect
.find(
{date:
{
$gte: new Date("2021-03-17T06:04:57.972+00:00"),
$lte: new Date("2021-04-17T06:04:57.972+00:00")
}
}
);
const defects = await Object.aggregate([
{
$lookup: {
from: "def",
localField: "_id",
foreignField: "objectId",
as: "d",
},
},
])
[
{
"_id": "607a688c1ee975025413bcea",
"control": false,
"passwords": "1",
"name": "name1",
"address": "address1",
"__v": 0,
"d": []
}
]