【发布时间】:2014-12-09 08:58:49
【问题描述】:
我有以下与 sequelize 相关的模型。
Event hasMany Characters through characters_attending_boss
Boss hasMany Characters through characters_attending_boss
Characters hasMany Event through characters_attending_boss
Characters hasMany Boss through characters_attending_boss
这些表已成功连接,我可以从中检索数据。但是当我检索 JSON 结果时,through 模型的名称被添加到每个对象中,如下所示:
{
id: 1
title: "title"
-confirmed_for: [ //Alias for Event -> Character
-{
id: 2
character_name: "name"
-confirmed_for_boss: [ // Alias for Boss -> Character
-{
id: 9
name: "name"
-character_attending_event: { // name of through-model
event_id: 1
char_id: 2
}
}
]
-character_attending_boss: { // name of through-model
event_id: 1
char_id: 2
}
}
因此,如果可能的话,我正在寻找一种方法来隐藏这些“character_attending_boss”段,最好不要更改获取后的结果。
这可能吗?
【问题讨论】:
标签: json express has-many sequelize.js