Fix id copmarison by using strings
This commit is contained in:
parent
f5270c39c5
commit
9363354e0f
|
@ -2268,7 +2268,7 @@ RelationDefinition.embedsMany = function embedsMany(modelFrom, modelTo, params)
|
|||
if (!params.polymorphic) {
|
||||
modelFrom.validate(propertyName, function(err) {
|
||||
var embeddedList = this[propertyName] || [];
|
||||
var ids = embeddedList.map(function(m) { return m[idName]; });
|
||||
var ids = embeddedList.map(function(m) { return m[idName].toString(); }); // mongodb
|
||||
var uniqueIds = ids.filter(function(id, pos) {
|
||||
return ids.indexOf(id) === pos;
|
||||
});
|
||||
|
@ -2869,7 +2869,7 @@ RelationDefinition.referencesMany = function referencesMany(modelFrom, modelTo,
|
|||
});
|
||||
|
||||
modelFrom.validate(relationName, function(err) {
|
||||
var ids = this[fk] || [];
|
||||
var ids = (this[fk] || []).map(function (id) {return id.toString(); }); // mongodb
|
||||
var uniqueIds = ids.filter(function(id, pos) {
|
||||
return ids.indexOf(id) === pos;
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue