Mongoose multi-table fuzzy query

this.find({}).populate({
            path: "userId",
            match: {name: "123123x"}
        }).exec(callback);

the associated query of two tables, and how to make the whole data not return when there is no data in the associated table

May.22,2021

use aggregate queries

db.projects.aggregate([{
    $lookup:{
        from:'users',
        localField: 'userId',
        foreignField: '_id',
        as: 'userinfo'
        }
},{
    $match:{
        'userinfo.sex': '0'
}},{"$unwind": "$remark"}])
Menu