我正在尝试使用 sequalize 查询获取每个成员的订阅者数量,但没有得到准确的响应。 错误:出现问题,s.replace 不是函数
<块引用>代码:
exports.getSingleMember = async (req, res, next) => {
try{
let member = await db.Member.scope('removePassword').findOne({
where:{username: req.params.uname},
include:[
{model: db.Gallery, attributes:['id','member_img']},
{model: db.Review, attributes:['id','review']},
{model: db.Country, required: true, attributes:['id','name']},
{model: db.City, attributes:['id','name']},
{model: db.Subscribe, attributes:['id',[[Sequelize.fn("COUNT", Sequelize.col('id')), 'total']] ]},
]
});
if(member != null) {
return responses.success(res, data = member);
} else {
return responses.notFound(res, errors = true, msg = "Member is not found.");
}
} catch (e) {
return responses.internalError(res, `Something went wrong, ${e.message}`);
}
}