While using Validatable.validate() the Custom function is throwing an internal loopback error.
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);
Error:
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