来自Sequelize的原始查询

时间:2017-01-04 01:33:07

标签: node.js sequelize.js

当我执行findAll时,是否有方法或属性可以看到将在我的MS SQL DB上执行的原始查询。

var sql= {where: query.id,
        attributes: queryAttrb,
        include: [
            {
                model: queryModel,
                where: dboQuery.spiStatus
            }]};

model.findAll(sql);

1 个答案:

答案 0 :(得分:0)

只需添加日志记录:

var sql = {
    where: query.id,
    attributes: queryAttrb,
    include: [
        {
            model: queryModel,
            where: dboQuery.spiStatus
        }],
    logging: console.log
};

model.findAll(sql);