在风帆控制台中无法使用Waterline进行基本查找

时间:2014-03-21 00:07:34

标签: sails.js waterline

我有一个搜索工作表的工作模型。该表是使用rails创建的,我设置了' migrate'安全'在工作模型中。我已经写出了模型中的所有属性。我无法在sails控制台中使用基本功能。我在表中有三个作业,ID为1,2和3.当我执行时:

sails> Job.findOneById(1).done(function(err,job){console.log(j.id)})

它消耗了我。帆控制台崩溃(超级烦人)。输出如下:

sails> Job.findOneById(1).done(function(err,job){console.log(j.id)})
undefined
sails> 
/home/redmage/tac/node_modules/sails-postgresql/lib/query.js:544
    var type = self._schema[key].type;
                                ^
TypeError: Cannot read property 'type' of undefined
    at /home/redmage/tac/node_modules/sails-postgresql/lib/query.js:544:33
    at Array.forEach (native)
    at Query.cast (/home/redmage/tac/node_modules/sails-postgresql/lib/query.js:541:23)
    at /home/redmage/tac/node_modules/sails-postgresql/lib/adapter.js:372:32
    at Array.forEach (native)
    at __FIND__ (/home/redmage/tac/node_modules/sails-postgresql/lib/adapter.js:371:23)
    at Query.handleReadyForQuery (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/query.js:84:10)
    at null.<anonymous> (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/client.js:159:19)
    at EventEmitter.emit (events.js:117:20)
    at null.<anonymous> (/home/redmage/tac/node_modules/sails-postgresql/node_modules/pg/lib/connection.js:97:12)
    at Socket.EventEmitter.emit (events.js:95:17)
    at Socket.<anonymous> (_stream_readable.js:746:14)
    at Socket.EventEmitter.emit (events.js:92:17)
    at emitReadable_ (_stream_readable.js:408:10)
    at emitReadable (_stream_readable.js:404:5)
    at readableAddChunk (_stream_readable.js:165:9)
    at Socket.Readable.push (_stream_readable.js:127:10)
    at TCP.onread (net.js:528:21)

这是Job的ORM。这是非常基础的:

module.exports = {

  //VERY IMPORTANT:
  migrate: 'safe', 

  tableName: 'jobs',

  attributes: {

  }
}

0 个答案:

没有答案