当我使用以下查询通过sequelize.js查询我的数据库时:
models.User.findAll({
attributes: ['name', 'company_id'],
where: {
id: 6
}
}).then( function( data ) {
console.log( data );
});
我明白了:
[ { dataValues: { name: 'John', company_id: 221 },
_previousDataValues: { name: 'John', company_id: 221 },
_changed: {},
'$modelOptions':
{ timestamps: true,
instanceMethods: {},
classMethods: {},
validate: {},
freezeTableName: false,
underscored: false,
underscoredAll: false,
paranoid: false,
whereCollection: [Object],
schema: null,
schemaDelimiter: '',
defaultScope: null,
scopes: [],
hooks: {},
indexes: [],
name: [Object],
tableName: 'users',
createdAt: 'created',
updatedAt: 'modified',
omitNull: false,
sequelize: [Object],
uniqueKeys: {},
hasPrimaryKeys: true },
'$options': { isNewRecord: false, raw: true, attributes: [Object] },
hasPrimaryKeys: true,
__eagerlyLoadedAssociations: [],
isNewRecord: false } ]
如何配置sequelize以便为我提供干净的数据,即只有数据行而不是其他内容。