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) {
|
this.constructor.all(cond, function (error, found) {
|
||||||
if (found.length > 1) {
|
if (found.length > 1) {
|
||||||
err();
|
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();
|
err();
|
||||||
}
|
}
|
||||||
done();
|
done();
|
||||||
|
|
Loading…
Reference in New Issue