-
-
Notifications
You must be signed in to change notification settings - Fork 610
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
If you retrieve an object with populate: true or inititialize a collection later which contains multiple references to the same item, it does not fill the object.
For example this example; the entity is retrieved with eager:false, populate: false and it initialized manually:
const m = await entity.entitiesthatlinktoent1.init({ populate: ["ent1"] });
console.log(m[0].entitiesthatlinktoent1, ent.entitiesthatlinktoent1[0].ent1); //these both log an initialized ent1 with "prop": "data"
return entity;
but it returns:
{"id":9,"ent1":{"id":23, "prop": "data"},"entitiesthatlinktoent1":[{"id":6,"ent1":{"id":23},"date":"2019-10-27T12:57:16.000Z"}]}//main enitity
@OneToOne(() => Entity1, e => e.parent)
ent1: Entity1;
//entity1
@OneToOne(() => Main)
parent: MainEntity;
@OneToMany(() => Entity2, e => e.ent1)
entitiesthatlinktoent1 = new Collection<Entity2>(this);
@Property({type:"string"})
prop: string;
//enitity2
@ManyToOne(() => Entity1, e => e.entitiesthatlinktoent1)
ent1: Entity1;
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working