以下功能应从模型服务器中获取一条记录,其中field' game'是' 5'
Servers.findOne({ where: { game : '5' } }).then(function(s){
fetched(s);
});
预期查询
SELECT ... WHERE'游戏' =' 5'
通过续集生成并执行的查询
执行(默认):SELECT
id
ASid
,address
ASaddress
,port
ASport
,game
ASgame
,priority
ASpriority
,createdAt
,updatedAt
FROMServers
ASServers
WHERE 1 = 1 < / strong> LIMIT 1;
Server.js(模型文件)
var Sequelize = require("sequelize");
module.exports=function(sequelize, DataTypes){
return sequelize.define("Servers", {
id: {
type: DataTypes.INTEGER,
field: "id",
autoIncrement: !0,
primaryKey: !0
},
address: {
type: DataTypes.STRING,
field: "address"
},
port: {
type: DataTypes.STRING,
field: "port"
},
game: {
type: DataTypes.INTEGER,
field: "game"
},
priority: {
type: DataTypes.INTEGER,
field: 'priority'
}
},
{
freezeTableName: true, // Model tableName will be the same as the model name
classMethods:{
},
instanceMethods:{
}
});
};
我在这里缺少什么?我