Explorar o código

push to undefined fix

Ivan Asmer %!s(int64=4) %!d(string=hai) anos
pai
achega
5368dfcf05
Modificáronse 1 ficheiros con 3 adicións e 1 borrados
  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}