Mongoose populate returning empty array

后端 未结 4 1013
我寻月下人不归
我寻月下人不归 2021-01-28 04:25

I am trying to use mongoose populate function but in response I am getting empty array, I have seen multiple posts regarding this

var MerchantSchema = new mongo         


        
4条回答
  •  自闭症患者
    2021-01-28 04:29

    Can you try by removing second parameter from the findBbyId:

    Merchant
    .findById( req.params.id)
    .populate('packages')
    .exec(function (err, merchant) {
        if (err)
            next(err);
        else
            res.status(200).json(merchant);
    });
    

提交回复
热议问题