Prevent json data from being added to json followed by

I have the following models related to 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

These tables have been successfully merged, and I can extract data from them. But when I get JSON results, the name of the pass-through model is added to each object, for example:

{
   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
    }
}

So, I'm looking for a way to hide these "character_attending_boss" segments, if possible, preferably without modifying the results of post-fetch.

Is it possible?

+4
source share
2 answers

Solved the same problem: https://github.com/sequelize/sequelize/issues/2541

To add through: {attributes: []}to enable block Sequelize 2.0 works well

+4

{ joinTableAttributes: [] } .

0

All Articles