You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue happens when there are multiple objects in the database, each object has an array of references, and at least two of the object's arrays contain the same reference.
Consider the following example:
classEyeextendsDocument{constructor(){super('eyes');this.color=String;}}classUserextendsDocument{constructor(){super('users');this.eyes=[Eye];}}varuser1=User.create();varuser2=User.create();vareye1=Eye.create({color: 'blue'});vareye2=Eye.create({color: 'brown'});eye1.save().then(function(e){returneye2.save();}).then(function(e){user1.eyes.push(eye1,eye2);returnuser1.save();}).then(function(u){user2.eyes.push(eye1);returnuser2.save();}).then(function(u){returnUser.loadMany({});}).then(function(users){// Get user1varu1=users[0].id===user1.id ? users[0] : users[1];// Ensure we have correct number of eyesexpect(u1.eyes).to.have.length(2);// FAILS});
In this case, both user1 and user2 have a reference to eye1. But when we call .loadMany(), both user1 and user2 will have a duplicate reference to eye1, which is not correct.
The text was updated successfully, but these errors were encountered:
This issue happens when there are multiple objects in the database, each object has an array of references, and at least two of the object's arrays contain the same reference.
Consider the following example:
In this case, both user1 and user2 have a reference to eye1. But when we call
.loadMany()
, both user1 and user2 will have a duplicate reference to eye1, which is not correct.The text was updated successfully, but these errors were encountered: