瀏覽代碼

push to undefined fix

Ivan Asmer 3 年之前
父節點
當前提交
5368dfcf05
共有 1 個文件被更改,包括 3 次插入1 次删除
  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}