使用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