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

时间:2015-10-04 14:27:40

标签: mysql node.js sails.js

我发现我正在

  

错误(E_UNKNOWN)::遇到意外错误       :ER_BAD_FIELD_ERROR:“字段列表”中的未知列“NaN”

我首先在分期(弹性豆茎)上注意到了这一点。当我做一个新的npm install时,我在本地注意到了这一点。我该如何调试错误?看来

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;
        }
    }
}

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

更新

刚刚尝试删除^中版本号中的所有~package.json,因此所有依赖项都安装在确切的版本中,但仍然失败...

1 个答案:

答案 0 :(得分:1)

我想问题出在win属性上。您可能不得不将其删除,而不是发送空字符串"win": ""