【问题标题】:SailsJS/MySQL: Unknown column 'NaN' in 'field list'SailsJS/MySQL:“字段列表”中的未知列“NaN”
【发布时间】:2016-01-01 06:42:16
【问题描述】:

我发现我得到了

错误 (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 中版本号中的所有^~,所以所有依赖项都安装在确切的版本中,但它仍然失败......

【问题讨论】:

    标签: mysql node.js sails.js


    【解决方案1】:

    我想问题出在win 属性上。而不是发送空字符串"win": "",您可能必须消除它。

    【讨论】:

      猜你喜欢
      • 2018-01-05
      • 2018-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多