Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sequelize exclude attributes

const my_model = await MyModel.findById(id, {
  include: [
    {
      model: AnotherModel,
      attributes: [ 'displayName', 'email' ] // only these attributes returned
    },
    { model: YetAnotherModel,
      include: [{
        model: AnotherModel,
        attributes: [ 'id', 'displayName', 'email' ]
      }]
    }
  ]
})
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sequelize #exclude #attributes
ADD COMMENT
Topic
Name
1+1 =