Skip to content

leftJoinAndMapOne does not add target property to entity #5637

@FFsim

Description

@FFsim

Issue type:

[ x] question
[ ] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)

The above will return the User, but without the lastPurchase property

      const users = await this.repository.createQueryBuilder("user")
      .leftJoinAndMapOne("user.lastPurchase", (subQuery) => {
        return subQuery
          .select()
          .from(Purchase, "purchase")
          .orderBy("created", "DESC");
      }, "purchase", "purchase.userId = user.id")
      .getManyAndCount();

any ideas?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions