Closed scottwrobinson closed 9 years ago
This issue happens when an object has an array of references and there are multiple references to the same object in the array.
In the code below, we give the user two references to the same Eye, but when we load the user there is only one reference there.
class Eye extends Document { constructor() { super('eyes'); this.color = String; } } class User extends Document { constructor() { super('users'); this.eyes = [Eye]; } } var user = User.create(); var eye = Eye.create({color: 'blue'}); eye.save().then(function(e) { user.eyes.push(eye, eye); return user.save(); }).then(function(u) { return User.loadMany({}); }).then(function(users) { expect(users[0].eyes).to.have.length(2); // FAILS });
This issue happens when an object has an array of references and there are multiple references to the same object in the array.
In the code below, we give the user two references to the same Eye, but when we load the user there is only one reference there.