我正在使用Sequelize-Mock,根据我的模型,我没想到会有id property or timestamps
可以抑制这些吗?
mock.js
var UserMock = DBConnectionMock.define('users', {
'Property1': 5,
'Property2': 10,
'Property3': 15,
'Property4': 25
})
// From there we can start using it like a normal model
exports.getTotals = () => {
return UserMock.findAll().then(r => r);
}
index.js console.log结果
[[ { Property1: 5,
Property2: 10,
Property3: 15,
Property4: 25,
id: 1,
createdAt: '2018-07-28T03:54:14.442Z',
updatedAt: '2018-07-28T03:54:14.442Z' } ]]
答案 0 :(得分:1)
要禁用timeStamps
设置,
timestamps: false
要防止创建主键id
,请将其他任何列设置为主键,如
Property1: {
type: Sequelize.STRING,
primaryKey: true
}