Skip to content

refactor: remove deprecated global APIs and ConnectionManager#12098

Merged
michaelbromley merged 7 commits intomasterfrom
remove-deprecated-globals
Mar 6, 2026
Merged

refactor: remove deprecated global APIs and ConnectionManager#12098
michaelbromley merged 7 commits intomasterfrom
remove-deprecated-globals

Conversation

@michaelbromley
Copy link
Copy Markdown
Member

Summary

  • Remove all deprecated global convenience functions from globals.ts (createConnection, getConnection, getManager, getRepository, createQueryBuilder, etc.)
  • Remove the deprecated ConnectionManager class and its tests
  • Update docs to replace removed API usage with dataSource methods
  • Document the removals in the v1 migration guide

Closes #12075

BREAKING CHANGE

The following deprecated global functions have been removed: createConnection, createConnections, getConnection, getConnectionManager, getConnectionOptions, getManager, getMongoManager, getSqljsManager, getRepository, getTreeRepository, getCustomRepository, getMongoRepository, createQueryBuilder. Use the equivalent methods on your DataSource instance instead.

The ConnectionManager class has been removed. Manage DataSource instances directly.

Remove all deprecated convenience functions from globals.ts
(createConnection, getConnection, getManager, getRepository, etc.)
leaving only the non-deprecated getMetadataArgsStorage function.
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Remove deprecated global APIs and ConnectionManager

✨ Enhancement 📝 Documentation

Grey Divider

Walkthroughs

Description
• Remove all deprecated global convenience functions from globals.ts
• Remove deprecated ConnectionManager class and its tests
• Update documentation to use DataSource methods instead
• Document API removals in v1 migration guide
Diagram
flowchart LR
  A["Deprecated Global APIs<br/>createConnection, getRepository, etc."] -->|removed| B["Use DataSource methods<br/>dataSource.getRepository()"]
  C["ConnectionManager class"] -->|removed| D["Manage DataSource directly"]
  E["Documentation updates"] -->|reflect| F["v1 migration guide"]
Loading

Grey Divider

File Changes

1. src/connection/ConnectionManager.ts Refactoring +0/-72

Remove deprecated ConnectionManager class

• Entire file removed (72 lines deleted)
• Contained deprecated ConnectionManager class with methods for managing multiple connections
• Class provided has(), get(), and create() methods for connection management

src/connection/ConnectionManager.ts


2. src/globals.ts Refactoring +13/-238

Remove deprecated global convenience functions

• Removed 225 lines of deprecated global convenience functions
• Removed: createConnection, createConnections, getConnection, getConnectionManager,
 getConnectionOptions, getManager, getMongoManager, getSqljsManager, getRepository,
 getTreeRepository, getCustomRepository, getMongoRepository, createQueryBuilder
• Kept only getMetadataArgsStorage() function with improved documentation
• Removed all related imports for ConnectionManager, ConnectionOptionsReader, and type imports

src/globals.ts


3. src/index.ts Refactoring +0/-1

Remove ConnectionManager from exports

• Removed export of ConnectionManager class
• Kept other exports like ConnectionOptionsReader and DataSource

src/index.ts


View more (4)
4. test/functional/connection-manager/connection-manager.test.ts 🧪 Tests +0/-259

Remove ConnectionManager test suite

• Entire test file removed (259 lines deleted)
• Contained tests for ConnectionManager.create() and ConnectionManager.get() methods
• Tested connection creation with MySQL driver and error handling

test/functional/connection-manager/connection-manager.test.ts


5. docs/docs/drivers/mongodb.md 📝 Documentation +1/-3

Update MongoDB docs to use DataSource

• Removed import statement for deprecated getMongoManager function
• Updated code example to use dataSource.mongoManager instead
• Changed from global function call to DataSource property access

docs/docs/drivers/mongodb.md


6. docs/docs/guides/8-migration-v1.md 📝 Documentation +33/-0

Document removed APIs in v1 migration guide

• Added new section documenting removed global convenience functions
• Listed all 11 removed functions with their replacements
• Provided before/after code examples showing migration path
• Added section documenting ConnectionManager removal

docs/docs/guides/8-migration-v1.md


7. docs/docs/query-builder/1-select-query-builder.md 📝 Documentation +20/-10

Update query builder docs to use DataSource

• Updated 8 code examples to use dataSource.createQueryBuilder() instead of global
 createQueryBuilder()
• Changed from standalone function calls to DataSource method calls
• Maintained all query builder functionality and logic

docs/docs/query-builder/1-select-query-builder.md


Grey Divider

Qodo Logo

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 5, 2026

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 97dcf67
Status: ✅  Deploy successful!
Preview URL: https://5f300df3.typeorm.pages.dev
Branch Preview URL: https://remove-deprecated-globals.typeorm.pages.dev

View logs

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects bot commented Mar 5, 2026

Code Review by Qodo

🐞 Bugs (62) 📘 Rule violations (13) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;quot;user&amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (62)
4. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;amp;quot;user&amp;amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;quot;user&amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;quot;user&amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Migration docs omit removed globals 📘 Rule violation ✓ Correctness
Description
The v1 migration guide’s removed-global-functions list does not include some globals stated as
removed in the PR (e.g., getMongoManager, getMongoRepository). This can mislead users upgrading
to v1 and leaves the breaking change incompletely documented.
Code

docs/docs/guides/8-migration-v1.md[R118-129]

+The following deprecated global functions have been removed:
+
+- `createConnection` / `createConnections`
+- `getConnection`
+- `getConnectionManager`
+- `getConnectionOptions`
+- `getManager`
+- `getSqljsManager`
+- `getRepository`
+- `getTreeRepository`
+- `createQueryBuilder`
+
Evidence
Compliance requires docs to reflect user-facing changes. The PR description lists additional removed
global functions, but the migration guide’s new “Global convenience functions” section omits at
least getMongoManager and getMongoRepository from the removed-functions list.

Rule 2: Docs updated for user-facing changes
docs/docs/guides/8-migration-v1.md[118-129]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v1 migration guide section &amp;amp;quot;Global convenience functions&amp;amp;quot; lists removed globals, but it omits some functions the PR declares as removed (e.g., `getMongoManager`, `getMongoRepository`). This makes the breaking change documentation incomplete.
## Issue Context
The PR description explicitly enumerates the removed global functions; the migration guide should match that list (or clearly explain why some are documented elsewhere).
## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[116-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


22. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


23. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


24. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;amp;quot;user&amp;amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


25. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
   .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
[src/data-source/DataSource.ts[544-586]](https://github.com/t...

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (2) 📘 Rule violations (1) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
    .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&quot;user&quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.

## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.

## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.

## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.

## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

3. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
 */
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.

## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.

## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@michaelbromley michaelbromley force-pushed the remove-deprecated-globals branch from b9ef8a8 to 8de35b0 Compare March 5, 2026 19:52
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 5, 2026

commit: 267db98

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (4) 📘 Rule violations (2) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Migration example wrong 🐞 Bug ✓ Correctness ⭐ New
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&quot;user&quot;)` with `dataSource.createQueryBuilder(&quot;user&quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.

### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&quot;user&quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.

### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
   .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;quot;user&amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;quot;user&amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;quot;user&amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
   .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;quot;user&amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (1)
4. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

5. getMetadataArgsStorage verbose comment 📘 Rule violation ⛯ Reliability
Description
A large, newly added numbered comment block in getMetadataArgsStorage() reads like
AI-generated/excessively defensive explanation and may be considered noise. This conflicts with the
requirement to avoid extra comments and style inconsistencies in changes.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
PR Compliance ID 4 requires avoiding AI-like slop such as unnecessary extra comments; the PR adds an
expanded, numbered rationale comment block in src/globals.ts as part of this change.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds an unusually long, numbered explanatory comment block in `getMetadataArgsStorage()` that may be considered AI-generated noise per the compliance checklist.
## Issue Context
Compliance requires avoiding extra comments and AI-like slop/style inconsistencies in changes.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.
## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@coveralls
Copy link
Copy Markdown

coveralls commented Mar 5, 2026

Coverage Status

coverage: 80.274%. first build
when pulling 97dcf67 on remove-deprecated-globals
into 7929b1a on master.

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (13) 📘 Rule violations (8) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Migration docs omit removed globals 📘 Rule violation ✓ Correctness ⭐ New
Description
The v1 migration guide’s removed-global-functions list does not include some globals stated as
removed in the PR (e.g., getMongoManager, getMongoRepository). This can mislead users upgrading
to v1 and leaves the breaking change incompletely documented.
Code

docs/docs/guides/8-migration-v1.md[R118-129]

+The following deprecated global functions have been removed:
+
+- `createConnection` / `createConnections`
+- `getConnection`
+- `getConnectionManager`
+- `getConnectionOptions`
+- `getManager`
+- `getSqljsManager`
+- `getRepository`
+- `getTreeRepository`
+- `createQueryBuilder`
+
Evidence
Compliance requires docs to reflect user-facing changes. The PR description lists additional removed
global functions, but the migration guide’s new “Global convenience functions” section omits at
least getMongoManager and getMongoRepository from the removed-functions list.

Rule 2: Docs updated for user-facing changes
docs/docs/guides/8-migration-v1.md[118-129]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v1 migration guide section &quot;Global convenience functions&quot; lists removed globals, but it omits some functions the PR declares as removed (e.g., `getMongoManager`, `getMongoRepository`). This makes the breaking change documentation incomplete.

## Issue Context
The PR description explicitly enumerates the removed global functions; the migration guide should match that list (or clearly explain why some are documented elsewhere).

## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[116-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;quot;user&amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (11)
4. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;quot;user&amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;quot;user&amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
   .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;quot;user&amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;quot;user&amp;quot;)` with `dataSource.createQueryBuilder(&amp;quot;user&amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;quot;user&amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;quot;user&amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

15. getMetadataArgsStorage verbose comment 📘 Rule violation ⛯ Reliability
Description
A large, newly added numbered comment block in getMetadataArgsStorage() reads like
AI-generated/excessively defensive explanation and may be considered noise. This conflicts with the
requirement to avoid extra comments and style inconsistencies in changes.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
PR Compliance ID 4 requires avoiding AI-like slop such as unnecessary extra comments; the PR adds an
expanded, numbered rationale comment block in src/globals.ts as part of this change.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds an unusually long, numbered explanatory comment block in `getMetadataArgsStorage()` that may be considered AI-generated noise per the compliance checklist.
## Issue Context
Compliance requires avoiding extra comments and AI-like slop/style inconsistencies in changes.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.
## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. getMetadataArgsStorage verbose comment 📘 Rule violation ⛯ Reliability
Description
A large, newly added numbered comment block in getMetadataArgsStorage() reads like
AI-generated/excessively defensive explanation and may be considered noise. This conflicts with the
requirement to avoid extra comments and style inconsistencies in changes.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
PR Compliance ID 4 requires avoiding AI-like slop such as unnecessary extra comments; the PR adds an
expanded, numbered rationale comment block in src/globals.ts as part of this change.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds an unusually long, numbered explanatory comment block in `getMetadataArgsStorage()` that may be considered AI-generated noise per the compliance checklist.
## Issue Context
Compliance requires avoiding extra comments and AI-like slop/style inconsistencies in changes.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (4)
18. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.
## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.
## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. getMetadataArgsStorage verbose comment 📘 Rule violation ⛯ Reliability
Description
A large, newly added numbered comment block in getMetadataArgsStorage() reads like
AI-generated/excessively defensive explanation and may be considered noise. This conflicts with the
requirement to avoid extra comments and style inconsistencies in changes.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
PR Compliance ID 4 requires avoiding AI-like slop such as unnecessary extra comments; the PR adds an
expanded, numbered rationale comment block in src/globals.ts as part of this change.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The PR adds an unusually long, numbered explanatory comment block in `getMetadataArgsStorage()` that may be considered AI-generated noise per the compliance checklist.
## Issue Context
Compliance requires avoiding extra comments and AI-like slop/style inconsistencies in changes.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Verbose comment in getMetadataArgsStorage 📘 Rule violation ✓ Correctness
Description
The PR replaces an existing short comment with a much longer, numbered narrative block that reads
like generated filler and is inconsistent with the file’s prior concise style. This introduces
comment noise without changing behavior.
Code

src/globals.ts[R5-19]

+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
*/
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
Evidence
Compliance ID 4 requires avoiding AI-like comment noise and inconsistent style; the modified block
comment in src/globals.ts is significantly expanded into a verbose numbered explanation without
functional impact.

Rule 4: Remove AI-generated noise
src/globals.ts[5-19]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The updated comment block in `getMetadataArgsStorage()` is significantly more verbose than before and introduces stylistic/comment noise that may be perceived as AI-generated slop.
## Issue Context
Compliance requires avoiding extra/AI-like comments and inconsistent style. The change is purely comment-level (no behavior change), so it can be safely simplified.
## Fix Focus Areas
- src/globals.ts[5-19]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@michaelbromley michaelbromley merged commit 6a0dd43 into master Mar 6, 2026
41 of 42 checks passed
@michaelbromley michaelbromley deleted the remove-deprecated-globals branch March 6, 2026 08:58
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (43) 📘 Rule violations (12) 📎 Requirement gaps (0)

Grey Divider


Action required

1. Docs still use globals 🐞 Bug ✓ Correctness ⭐ New
Description
The query-builder guide still contains many unqualified createQueryBuilder(...) examples, but the
global convenience functions were removed from globals.ts and are no longer re-exported. Users
following the guide will hit missing-symbol errors or copy invalid code.
Code

src/globals.ts[R1-25]

import { MetadataArgsStorage } from "./metadata-args/MetadataArgsStorage"
import { PlatformTools } from "./platform/PlatformTools"
-import type { DataSourceOptions } from "./data-source/DataSourceOptions"
-import { ConnectionOptionsReader } from "./connection/ConnectionOptionsReader"
-import { ConnectionManager } from "./connection/ConnectionManager"
-import { getFromContainer } from "./container"
-import type { DataSource } from "./data-source/DataSource"
-import type { EntityManager } from "./entity-manager/EntityManager"
-import type { SqljsEntityManager } from "./entity-manager/SqljsEntityManager"
-import type { EntityTarget } from "./common/EntityTarget"
-import type { Repository } from "./repository/Repository"
-import type { TreeRepository } from "./repository/TreeRepository"
-import type { SelectQueryBuilder } from "./query-builder/SelectQueryBuilder"
-import { ObjectUtils } from "./util/ObjectUtils"
-import type { ObjectLiteral } from "./common/ObjectLiteral"

/**
- * Gets metadata args storage.
+ * Returns the singleton MetadataArgsStorage, creating it on the global scope if it
+ * does not already exist.
 */
export function getMetadataArgsStorage(): MetadataArgsStorage {
-    // we should store metadata storage in a global variable otherwise it brings too much problems
-    // one of the problem is that if any entity (or any other) will be imported before consumer will call
-    // useContainer method with his own container implementation, that entity will be registered in the
-    // old old container (default one post probably) and consumer will his entity.
-    // calling useContainer before he imports any entity (or any other) is not always convenient.
-    // another reason is that when we run migrations typeorm is being called from a global package
-    // and it may load entities which register decorators in typeorm of local package
-    // this leads to impossibility of usage of entities in migrations and cli related operations
+    // We store the metadata storage in a global variable to avoid several problems:
+    //
+    // 1. If any entity (or other decorated class) is imported before the consumer calls
+    //    useContainer with a custom container implementation, that entity will be registered
+    //    in the old (default) container and the consumer will lose access to it. Requiring
+    //    useContainer to be called before importing any entity is not always convenient.
+    //
+    // 2. When running migrations, TypeORM may be invoked from a globally installed package
+    //    while loading entities that register decorators against a locally installed copy.
+    //    Without a shared global storage, entities become unavailable in migrations and
+    //    CLI-related operations.
    const globalScope = PlatformTools.getGlobalVariable()
    if (!globalScope.typeormMetadataArgsStorage)
        globalScope.typeormMetadataArgsStorage = new MetadataArgsStorage()

    return globalScope.typeormMetadataArgsStorage
}
-
-/**
- * Reads connection options stored in ormconfig configuration file.
- * @param connectionName
- * @deprecated
- */
-export async function getConnectionOptions(
-    connectionName: string = "default",
-): Promise<DataSourceOptions> {
-    return new ConnectionOptionsReader().get(connectionName)
-}
-
-/**
- * Gets a ConnectionManager which creates connections.
- * @deprecated
- */
-export function getConnectionManager(): ConnectionManager {
-    return getFromContainer(ConnectionManager)
-}
-
-/**
- * Creates a new connection and registers it in the manager.
- * Only one connection from ormconfig will be created (name "default" or connection without name).
- * @deprecated
- */
-export async function createConnection(): Promise<DataSource>
-
-/**
- * Creates a new connection from the ormconfig file with a given name.
- * @param name
- * @deprecated
- */
-export async function createConnection(name: string): Promise<DataSource>
-
-/**
- * Creates a new connection and registers it in the manager.
- * @param options
- * @deprecated
- */
-export async function createConnection(
-    options: DataSourceOptions,
-): Promise<DataSource>
-
-/**
- * Creates a new DataSource and registers it in the manager.
- *
- * If the data source options were not specified, then it will try to create the DataSource automatically,
- * based on the content of the ormconfig (json/js/env) file or environment variables.
- * Only one DataSource from ormconfig will be created (name "default" or DataSource without name).
- * @param optionsOrName
- * @deprecated
- */
-export async function createConnection(
-    optionsOrName?: any,
-): Promise<DataSource> {
-    const dataSourceName =
-        typeof optionsOrName === "string" ? optionsOrName : "default"
-    const options = ObjectUtils.isObject(optionsOrName)
-        ? (optionsOrName as DataSourceOptions)
-        : await getConnectionOptions(dataSourceName)
-    return getConnectionManager().create(options).initialize()
-}
-
-/**
- * Creates new connections and registers them in the manager.
- *
- * If connection options were not specified, then it will try to create connection automatically,
- * based on content of ormconfig (json/js/env) file or environment variables.
- * All connections from the ormconfig will be created.
- * @param options
- * @deprecated
- */
-export async function createConnections(
-    options?: DataSourceOptions[],
-): Promise<DataSource[]> {
-    if (!options) options = await new ConnectionOptionsReader().all()
-    const connections = options.map((options) =>
-        getConnectionManager().create(options),
-    )
-    // Do not use Promise.all or test 8522 will produce a dangling sqlite connection
-    for (const connection of connections) {
-        await connection.initialize()
-    }
-    return connections
-}
-
-/**
- * Gets connection from the connection manager.
- * If connection name wasn't specified, then "default" connection will be retrieved.
- * @param connectionName
- * @deprecated
- */
-export function getConnection(connectionName: string = "default"): DataSource {
-    return getConnectionManager().get(connectionName)
-}
-
-/**
- * Gets entity manager from the connection.
- * If connection name wasn't specified, then "default" connection will be retrieved.
- * @param connectionName
- * @deprecated
- */
-export function getManager(connectionName: string = "default"): EntityManager {
-    return getConnectionManager().get(connectionName).manager
-}
-
-/**
- * Gets Sqljs entity manager from connection name.
- * "default" connection is used, when no name is specified.
- * Only works when Sqljs driver is used.
- * @param connectionName
- * @deprecated
- */
-export function getSqljsManager(
-    connectionName: string = "default",
-): SqljsEntityManager {
-    return getConnectionManager().get(connectionName)
-        .manager as SqljsEntityManager
-}
-
-/**
- * Gets repository for the given entity class.
- * @param entityClass
- * @param connectionName
- * @deprecated
- */
-export function getRepository<Entity extends ObjectLiteral>(
-    entityClass: EntityTarget<Entity>,
-    connectionName: string = "default",
-): Repository<Entity> {
-    return getConnectionManager()
-        .get(connectionName)
-        .getRepository<Entity>(entityClass)
-}
-
-/**
- * Gets tree repository for the given entity class.
- * @param entityClass
- * @param connectionName
- * @deprecated
- */
-export function getTreeRepository<Entity extends ObjectLiteral>(
-    entityClass: EntityTarget<Entity>,
-    connectionName: string = "default",
-): TreeRepository<Entity> {
-    return getConnectionManager()
-        .get(connectionName)
-        .getTreeRepository<Entity>(entityClass)
-}
-
-/**
- * Creates a new query builder.
- * @param entityClass
- * @param alias
- * @param connectionName
- * @deprecated
- */
-export function createQueryBuilder<Entity extends ObjectLiteral>(
-    entityClass?: EntityTarget<Entity>,
-    alias?: string,
-    connectionName: string = "default",
-): SelectQueryBuilder<Entity> {
-    if (entityClass) {
-        return getRepository(entityClass, connectionName).createQueryBuilder(
-            alias,
-        )
-    }
-
-    return getConnection(connectionName).createQueryBuilder()
-}
Evidence
src/index.ts re-exports everything from ./globals, and globals.ts now only exports
getMetadataArgsStorage, meaning global createQueryBuilder no longer exists. However, the
query-builder guide still shows direct createQueryBuilder() usage in multiple code blocks.

src/globals.ts[1-25]
src/index.ts[9-10]
docs/docs/query-builder/1-select-query-builder.md[248-272]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

### Issue description
The query-builder documentation still uses the removed global `createQueryBuilder(...)` function in multiple examples. Since `globals.ts` no longer exports this API (and `index.ts` re-exports from `globals.ts`), these examples are now incorrect.

### Issue Context
This PR intentionally removed deprecated global convenience functions, so docs should consistently demonstrate `dataSource` or `manager/repository` based patterns.

### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[246-575]
- src/globals.ts[1-25]
- src/index.ts[8-12]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;quot;user&amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View more (42)
4. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;amp;quot;user&amp;amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


6. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


7. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


8. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


9. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
  .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


10. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


11. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;quot;user&amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;quot;user&amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


12. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;quot;user&amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


13. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
 .leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;quot;user&amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


14. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


15. Migration docs omit removed globals 📘 Rule violation ✓ Correctness
Description
The v1 migration guide’s removed-global-functions list does not include some globals stated as
removed in the PR (e.g., getMongoManager, getMongoRepository). This can mislead users upgrading
to v1 and leaves the breaking change incompletely documented.
Code

docs/docs/guides/8-migration-v1.md[R118-129]

+The following deprecated global functions have been removed:
+
+- `createConnection` / `createConnections`
+- `getConnection`
+- `getConnectionManager`
+- `getConnectionOptions`
+- `getManager`
+- `getSqljsManager`
+- `getRepository`
+- `getTreeRepository`
+- `createQueryBuilder`
+
Evidence
Compliance requires docs to reflect user-facing changes. The PR description lists additional removed
global functions, but the migration guide’s new “Global convenience functions” section omits at
least getMongoManager and getMongoRepository from the removed-functions list.

Rule 2: Docs updated for user-facing changes
docs/docs/guides/8-migration-v1.md[118-129]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The v1 migration guide section &amp;amp;quot;Global convenience functions&amp;amp;quot; lists removed globals, but it omits some functions the PR declares as removed (e.g., `getMongoManager`, `getMongoRepository`). This makes the breaking change documentation incomplete.
## Issue Context
The PR description explicitly enumerates the removed global functions; the migration guide should match that list (or clearly explain why some are documented elsewhere).
## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[116-145]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


16. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


17. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


18. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.
Code

docs/docs/drivers/mongodb.md[R205-206]

+const manager = dataSource.mongoManager
await manager.save(user)
Evidence
The page defines the DataSource instance as myDataSource, but the updated example uses
dataSource.mongoManager without defining dataSource. This creates a copy/paste runtime failure
in documentation.

docs/docs/drivers/mongodb.md[117-126]
docs/docs/drivers/mongodb.md[192-206]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
MongoDB docs reference `dataSource.mongoManager` but only define `myDataSource`.
## Issue Context
After removing `getMongoManager()`, the example must access the manager via the actual `DataSource` instance variable used in the page.
## Fix Focus Areas
- docs/docs/drivers/mongodb.md[118-126]
- docs/docs/drivers/mongodb.md[205-206]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


19. Migration example wrong 🐞 Bug ✓ Correctness
Description
The v1 migration guide suggests const qb = dataSource.createQueryBuilder("user"), which is not a
valid DataSource.createQueryBuilder usage. This will fail TypeScript type-checking and does not
establish the main alias/from needed for a working query builder.
Code

docs/docs/guides/8-migration-v1.md[R138-139]

+const repo = dataSource.getRepository(User)
+const qb = dataSource.createQueryBuilder("user")
Evidence
The migration guide’s “After” snippet calls dataSource.createQueryBuilder("user") with one
argument, but DataSource.createQueryBuilder requires (entityClass, alias) to create a query
builder with a main alias; the 1-arg overload is for QueryRunner only.

docs/docs/guides/8-migration-v1.md[132-140]
src/data-source/DataSource.ts[547-586]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The migration guide instructs users to replace the removed global `createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)` with `dataSource.createQueryBuilder(&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;)`, which is not a valid overload for `DataSource.createQueryBuilder`.
### Issue Context
`DataSource.createQueryBuilder` requires `(entityClass, alias)` to create a query builder with a main alias (e.g., `&amp;amp;amp;amp;quot;user&amp;amp;amp;amp;quot;`). With one argument, it is the `queryRunner?: QueryRunner` overload.
### Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[132-140]
- src/data-source/DataSource.ts[544-586]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


20. Invalid DataSource QB docs 🐞 Bug ✓ Correctness
Description
The select query builder docs now show dataSource.createQueryBuilder("user"), but
DataSource.createQueryBuilder has no overload that accepts a single string alias; the 1-arg
overload is for QueryRunner, so this example is invalid/misleading.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
DataSource.createQueryBuilder requires (entityClass, alias) when providing an alias. If alias
is omitted, the method treats the first parameter as a QueryRunner and constructs
SelectQueryBuilder with it, meaning a string like "user" is not a valid call. The same doc file
already demonstrates the correct pattern via
dataSource.getRepository(User).createQueryBuilder("user").

src/data-source/DataSource.ts[554-596]
docs/docs/query-builder/1-select-query-builder.md[11-16]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Docs now show `dataSource.createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string alias. This is an invalid example and will confuse users.
### Issue Context
`DataSource.createQueryBuilder` overloads are:
- `(entityClass, alias, queryRunner?)`
- `(queryRunner?)`
So alias-only calls must be via repository (`dataSource.getRepository(User).createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`) or by providing the entity target (`dataSource.createQueryBuilder(User, &amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`).
### Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-809]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


21. Invalid createQueryBuilder docs 🐞 Bug ✓ Correctness
Description
Docs now use dataSource.createQueryBuilder("user"), but DataSource.createQueryBuilder requires
either (entity, alias) or a QueryRunner; a single string argument won’t type-check and can’t
produce the intended aliased query builder.
Code

docs/docs/query-builder/1-select-query-builder.md[R624-626]

+const user = await dataSource
+    .createQueryBuilder("user")
.leftJoinAndSelect("user.photos", "photo")
Evidence
The documentation example calls dataSource.createQueryBuilder("user") with a single string
argument. In the actual API, DataSource.createQueryBuilder only overloads to `(entityClass, alias,
queryRunner?) or (queryRunner?); when no alias` is provided, the implementation treats the first
argument as a QueryRunner, so a string is not a valid usage for producing an aliased builder.

docs/docs/query-builder/1-select-query-builder.md[621-629]
src/data-source/DataSource.ts[544-586]
docs/docs/query-builder/1-select-query-builder.md[68-100]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The docs call `dataSource.createQueryBuilder(&amp;amp;amp;amp;amp;quot;user&amp;amp;amp;amp;amp;quot;)`, but `DataSource.createQueryBuilder` does not accept a single string argument for creating an aliased query builder.
## Issue Context
`DataSource.createQueryBuilder` requires `(entityTarget, alias)` to build a query builder with `FROM`/`SELECT` preconfigured, or it takes a `QueryRunner` when called with a single argument.
## Fix Focus Areas
- docs/docs/query-builder/1-select-query-builder.md[624-626]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


22. Mongo docs undefined variable 🐞 Bug ✓ Correctness
Description
MongoDB docs now use dataSource.mongoManager, but the page bootstraps myDataSource; the snippet
references an undefined identifier and will fail if copied.

<detai...

@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

@pkuczynski pkuczynski added this to the 1.0 milestone Mar 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Remove all container-related features and everything in globals.ts (XS)

4 participants