Selaa lähdekoodia

push to undefined fix

Ivan Asmer 3 vuotta sitten
vanhempi
commit
5368dfcf05
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      index.js

+ 3 - 1
index.js

@@ -212,7 +212,9 @@ const mm = db => {
 
                 if (!Savable.existsInArray(this[ourRelationName], ref)) {
                     this[ourRelationName].push(ref)
-                    this._id && this._loadRelations[ourRelationName].push(ref)
+                    if (this._id && this._loadRelations[ourRelationName] instanceof Array){
+                        this._loadRelations[ourRelationName].push(ref)
+                    }
                 }
 
                 query = {$addToSet: shortQuery}