Skip to content

Relations not being returned in some cases #9774

Closed

Description

@ahmadnazir

Issue description

Relations are not being returned when using columns with DeleteDateColumn annotation

Expected Behavior

Assuming that you have the following entities:

  • Address many to one Person - eager loaded
  • Person one to many Car

then the following code should return the relation for cars:

        repo.find({
            relations: [
                "person",
                "person.cars"
            ]
        })

Actual Behavior

        repo.find({
            relations: [
                "person",
                "person.cars", // <- Not returned
            ]
        })

Steps to reproduce

Here is a test case that reproduces the error: 0.2.45...ahmadnazir:typeorm:chore/eager-relations-with-delete-column/1

My Environment

Dependency Version
Operating System Debian 11 (bullseye)
Node.js version 16.18.0
Typescript version 4.9.4
TypeORM version 0.2.35, 0.2.45

Additional Context

As a workaround, the loadEagerRelations can be set to false and the relations are returned.

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

No, I don’t have the time, but I can support (using donations) development.

Activity

  1. zexcs commented on May 19, 2023

    @zexcs

    I can confirm this issue.

    TypeORM version: 0.3.6

    Another workaround is to use { withDeleted: true } but neither of the workarounds are useful since it is breaking the intended behaviour of soft-deletion and eager.

  2. github-actions commented on Sep 18, 2025

    @github-actions

    TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).

    As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.

    🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
    If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions