'"relatedEntities.forEach is not a function" typeorm update entity error

@Entity('Properties')
class Property extends BaseEntity {
    @PrimaryGeneratedColumn()
    _id!: string;
    
    @ManyToOne(() => Host, (host) => host.property, {
        
    })
    @JoinColumn()
    host!: Host;

@Entity('hosts')
class Host extends BaseEntity {
    @PrimaryGeneratedColumn()
    _id!: string;

    @OneToMany(() => Property, property => property.host, {
        cascade: true,
        eager: true,
    })
    property!: Property[]

i am trying to update the user entity with the property relation and i get the above error using this code.

const host = await transactionalEntityManager.findOneByOrFail(Host, { _id: req.user.host._id});
            Object.assign(host, { property: property });
            await transactionalEntityManager.save(host);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source