SailsJS / MySQL:’字段列表’中的未知列’NaN’

我发现我得到了

Error (E_UNKNOWN) :: Encountered an unexpected error
: ER_BAD_FIELD_ERROR: Unknown column ‘NaN’ in ‘field list’

我第一次注意到这是在分期(弹性豆茎).当我做一个新的npm安装时,在本地注意到这一点.我该如何调试错误?看起来

Survey.create(params)

是原因.但我无法弄清楚为什么… params看起来像

{
  "name": "ADDSW",
  "description": "rewgre",
  "url": "https://www.surveymonkey.com/r/my-survey-name?uid=[uid_value]&sid=[sid_value]",
  "image": "https://s3-ap-southeast-1.amazonaws.com/meclub/savVD/35/zx.jpg",
  "points": "111",
  "trackingCode": "EN201510EXFABPSSADON",
  "transaction_partner": "EX",
  "transaction_department": "FAB",
  "transaction_campaign": "ADON",
  "win": ""
}

调查模型:

var shortid = require('shortid');

module.exports = {
    autoPK: false,

    attributes: {
        id: {
            type: 'string',
            unique: true,
            index: true,
            primaryKey: true,
            defaultsTo: function() {
                return shortid.generate();
            }
        },
        name: {
            type: 'string',
            required: true
        },
        description: {
            type: 'string',
            defaultsTo: ''
        },
        url: {
            type: 'string',
            required: true
        },
        image: {
            type: 'string',
            required: true
        },
        points: {
            type: 'integer',
            required: true
        },

        win: {
            model: 'win'
        },

        trackingCode: {
            type: 'string',
            required: true
        },
        transaction_partner: {
            type: 'string'
        },
        transaction_department: {
            type: 'string'
        },
        transaction_campaign: {
            type: 'string'
        },

        toJSON: function() {
            var obj = this.toObject();
            obj = _.omit(obj, ['createdAt', 'updatedAt', 'transaction_partner', 'transaction_department', 'transaction_campaign']);

            return obj;
        }
    }
}

好像有些包导致错误?但我无法弄清楚哪个……

UPDATE

刚尝试删除package.json中版本号中的所有^和〜所以所有依赖项都安装在确切的版本中,但它仍然失败…

最佳答案 我想问题是win属性.而不是发送空字符串“赢”:“”,你可能不得不消除它.

点赞