Javascript 通过关联将包含的内容续集化

Javascript 通过关联将包含的内容续集化,javascript,sql,sequelize.js,Javascript,Sql,Sequelize.js,是否可以通过关联在sequelize中包含。。 我已经试过这样的代码,但它返回错误 TypeError:无法读取未定义的属性“includes” 我使用的是sql方言 let instructorGrade = await model.Instructor.findOne({ where: { id }, attributes: ['id'], include: [

是否可以通过关联在sequelize中包含。。 我已经试过这样的代码,但它返回错误

TypeError:无法读取未定义的属性“includes”

我使用的是sql方言

let instructorGrade = await model.Instructor.findOne({
                where: { id },
                attributes: ['id'],
                include: [
                    {
                        model: model.SchoolGrade,
                        as: 'instructorSchoolGrades',
                        through: {
                            include: [
                                {
                                    model: model.Grade,
                                    as: 'schoolGrades'
                                },
                                {
                                    model: model.Section,
                                    as: 'schoolGradeSection'
                                }
                            ]
                        }
                    }
                ]
            });
这里是github的问题,与我的问题相同,但我还没有找到任何解决方案 [1] :

您应该使用。例如,您的查询可能类似于:

let instructorGrade = await model.Instructor.findOne({
    where: { id },
    attributes: ['id'],
    include: [
        {
            model: model.SchoolGrade,
            as: 'instructorSchoolGrades',
            include: [
                {
                    model: model.Grade,
                    as: 'schoolGrades'
                },
                {
                    model: model.Section,
                    as: 'schoolGradeSection'
                }
            ]

        }
    ]
});