How do MongoDB nested queries return all data?


clipboard.png
id!

this is my current practice. The problem is that the last res.send () only deals with the first traversal. If you put res.send () outside the traversal, the value of goodsList does not change. Is there a big answer?

Mar.08,2021

db.Classify.aggregation([{
    $lookup:{
       from: "Good",
       localField: "_id",
       foreignField: "classify_id",
       as: "goodsList"
    }
}])

nested queries
mongo support aggregation


later discovered that async.mapSeries can aggregate the results of multiple tasks

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b35c80-2bfb5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b35c80-2bfb5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?