环回自定义验证引发错误

时间:2015-06-25 04:30:05

标签: loopbackjs strongloop

使用Validatable.validate()时,Custom函数会抛出内部环回错误。

var duplicateConnection = function(err, done, er) {
Connection.find({where: {userId: this.userId, nucleusId: this.nucleusId}}, 
 function(bug, connection) {
   if (!_.isEmpty(connection)) {err();}
 });
};
Connection.validate("userId", duplicateConnection);

错误:

if (kind !== false) inst.errors.add(attr, message, code);
                                ^
TypeError: undefined is not a function
 at \node_modules\loopback-datasource-juggler\lib\validations.js:550:37

0 个答案:

没有答案
相关问题