Fix uniqueness validation (mongo ids)
This commit is contained in:
parent
d03dbfcb99
commit
59e80e8454
|
@ -257,7 +257,7 @@ function validateUniqueness(attr, conf, err, done) {
|
|||
this.constructor.all(cond, function (error, found) {
|
||||
if (found.length > 1) {
|
||||
err();
|
||||
} else if (found.length === 1 && found[0].id != this.id) {
|
||||
} else if (found.length === 1 && (!this.id || !found[0].id || found[0].id.toString() != this.id.toString())) {
|
||||
err();
|
||||
}
|
||||
done();
|
||||
|
|
Loading…
Reference in New Issue