Skip to content

refactor(mongodb)!: remove deprecated connection options#12120

Merged
pkuczynski merged 2 commits into
masterfrom
refactor/remove-deprecated-mongodb-options
Mar 6, 2026
Merged

refactor(mongodb)!: remove deprecated connection options#12120
pkuczynski merged 2 commits into
masterfrom
refactor/remove-deprecated-mongodb-options

Conversation

@pkuczynski
Copy link
Copy Markdown
Member

@pkuczynski pkuczynski commented Mar 6, 2026

Removes six deprecated MongoDB connection options from MongoDriver.validOptionNames:

  • useNewUrlParser — no-op since MongoDB Driver v4.0
  • useUnifiedTopology — no-op since MongoDB Driver v4.0
  • appname — replaced by appName (camelCase), already in the list
  • fsync — deprecated write concern option, use writeConcern: { journal: true }
  • j — deprecated write concern option, use writeConcern: { journal: true }
  • wtimeout — deprecated write concern option, use writeConcern: { wtimeoutMS: ... }

These were either no-ops or deprecated aliases since MongoDB Node.js Driver v4.0.0 and only produced deprecation warnings in CI logs.

Also updates CI/sample config files, the URL-parsing test, and adds a migration guide entry.

Part of #11603.

@pkuczynski pkuczynski self-assigned this Mar 6, 2026
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Review Summary by Qodo

Remove deprecated MongoDB connection options

✨ Enhancement

Grey Divider

Walkthroughs

Description
• Remove six deprecated MongoDB connection options from driver
• Update test cases to remove deprecated option references
• Update CI and sample configuration files accordingly
• Add migration guide for deprecated MongoDB options
Diagram
flowchart LR
  A["MongoDriver validOptionNames"] -- "remove 6 deprecated options" --> B["Cleaned option list"]
  C["Test configurations"] -- "remove deprecated params" --> D["Updated test suite"]
  E["Sample configs"] -- "remove deprecated params" --> F["Updated configs"]
  G["Migration guide"] -- "add removal documentation" --> H["v1 migration docs"]
Loading

Grey Divider

File Changes

1. src/driver/mongodb/MongoDriver.ts ✨ Enhancement +0/-8

Remove deprecated MongoDB options from driver

• Removed six deprecated MongoDB connection options from validOptionNames array
• Removed options: appname, fsync, j, useNewUrlParser, useUnifiedTopology, wtimeout
• Removed associated TODO comment about removal in next major version

src/driver/mongodb/MongoDriver.ts


2. test/github-issues/7437/issue-7437.test.ts 🧪 Tests +1/-6

Update test to remove deprecated option

• Removed useUnifiedTopology=true parameter from MongoDB connection URL
• Removed test assertion checking for useUnifiedTopology option parsing

test/github-issues/7437/issue-7437.test.ts


3. .github/workflows/test/mongodb.ormconfig.json ⚙️ Configuration changes +1/-3

Remove deprecated options from CI config

• Removed useNewUrlParser: true configuration
• Removed useUnifiedTopology: true configuration

.github/workflows/test/mongodb.ormconfig.json


View more (2)
4. ormconfig.sample.json ⚙️ Configuration changes +1/-3

Remove deprecated options from sample config

• Removed useNewUrlParser: true from MongoDB sample configuration
• Removed useUnifiedTopology: true from MongoDB sample configuration

ormconfig.sample.json


5. docs/docs/guides/8-migration-v1.md 📝 Documentation +31/-16

Add MongoDB migration guide for removed options

• Added new MongoDB section documenting removed connection options
• Created migration table showing deprecated options and their replacements
• Moved getMongoRepository and getMongoManager deprecation section earlier in MongoDB section
• Provided clear migration paths for each removed option

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


Grey Divider

Qodo Logo

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

Deploying typeorm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 52bfb9c
Status: ✅  Deploy successful!
Preview URL: https://929cdf88.typeorm.pages.dev
Branch Preview URL: https://refactor-remove-deprecated-m.typeorm.pages.dev

View logs

@pkuczynski pkuczynski changed the title refactor(mongodb): remove deprecated connection options refactor(mongodb)!: remove deprecated connection options Mar 6, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 6, 2026

commit: 52bfb9c

@pkuczynski pkuczynski enabled auto-merge (squash) March 6, 2026 22:43
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

qodo-free-for-open-source-projects Bot commented Mar 6, 2026

Code Review by Qodo

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

Grey Divider


Action required

1. Silent Mongo option drop 🐞 Bug ⛯ Reliability
Description
Removed MongoDB options are now silently ignored (not forwarded to the MongoDB driver) with no
validation/warning, which can change behavior for existing configs—especially write-concern related
options—and be very hard to diagnose.
Code

src/driver/mongodb/MongoDriver.ts[L211-218]

-        // Undocumented deprecated options
-        // todo: remove next major version
-        "appname",
-        "fsync",
-        "j",
-        "useNewUrlParser",
-        "useUnifiedTopology",
-        "wtimeout",
Evidence
MongoDriver only forwards allowlisted keys to MongoClient via buildConnectionOptions, while
validateOptions is effectively empty; after this PR, the removed keys are no longer allowlisted, so
they will be dropped without any user-visible warning/error.

src/driver/mongodb/MongoDriver.ts[160-211]
src/driver/mongodb/MongoDriver.ts[575-595]
src/driver/mongodb/MongoDriver.ts[521-527]
src/driver/DriverUtils.ts[250-307]

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 deprecated options were removed from the forwarding allowlist. Today, if users still provide these keys (either as top-level DataSource options in JS, or via MongoDB URL query params), TypeORM will silently ignore them because `buildConnectionOptions()` only forwards allowlisted keys and `validateOptions()` does nothing.
This creates a silent misconfiguration mode and may change behavior (notably for write concern-related options) without any diagnostics.
## Issue Context
- URL query params are parsed into a flat object and merged into driver options.
- Only keys in `validOptionNames` are forwarded to the MongoDB driver.
- The PR removed several keys from `validOptionNames`, so they are now dropped.
## Fix Focus Areas
- src/driver/mongodb/MongoDriver.ts[160-211]
- src/driver/mongodb/MongoDriver.ts[521-527]
- src/driver/mongodb/MongoDriver.ts[575-595]
- src/driver/DriverUtils.ts[250-307]
## Suggested approach
1. After options are fully built (post-URL-parse merge), detect presence of removed keys: `appname`, `fsync`, `j`, `useNewUrlParser`, `useUnifiedTopology`, `wtimeout`.
2. Throw a clear `TypeORMError` (or log a deprecation-removal warning) describing how to migrate.
3. (Optional) Add a small compatibility mapping for the non-nested equivalents where safe:
- `appname` -> `appName`
- `wtimeout` -> `wtimeoutMS`
Keep `fsync`/`j` as hard errors (or map into `writeConcern` if you explicitly support that), but still warn/throw.
4. Add/adjust a test to assert that providing one of the removed options causes the expected warning/error.

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


2. Silent Mongo option drop 🐞 Bug ⛯ Reliability
Description
Removed MongoDB options are now silently ignored (not forwarded to the MongoDB driver) with no
validation/warning, which can change behavior for existing configs—especially write-concern related
options—and be very hard to diagnose.
Code

src/driver/mongodb/MongoDriver.ts[L211-218]

-        // Undocumented deprecated options
-        // todo: remove next major version
-        "appname",
-        "fsync",
-        "j",
-        "useNewUrlParser",
-        "useUnifiedTopology",
-        "wtimeout",
Evidence
MongoDriver only forwards allowlisted keys to MongoClient via buildConnectionOptions, while
validateOptions is effectively empty; after this PR, the removed keys are no longer allowlisted, so
they will be dropped without any user-visible warning/error.

src/driver/mongodb/MongoDriver.ts[160-211]
src/driver/mongodb/MongoDriver.ts[575-595]
src/driver/mongodb/MongoDriver.ts[521-527]
src/driver/DriverUtils.ts[250-307]

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 deprecated options were removed from the forwarding allowlist. Today, if users still provide these keys (either as top-level DataSource options in JS, or via MongoDB URL query params), TypeORM will silently ignore them because `buildConnectionOptions()` only forwards allowlisted keys and `validateOptions()` does nothing.
This creates a silent misconfiguration mode and may change behavior (notably for write concern-related options) without any diagnostics.
## Issue Context
- URL query params are parsed into a flat object and merged into driver options.
- Only keys in `validOptionNames` are forwarded to the MongoDB driver.
- The PR removed several keys from `validOptionNames`, so they are now dropped.
## Fix Focus Areas
- src/driver/mongodb/MongoDriver.ts[160-211]
- src/driver/mongodb/MongoDriver.ts[521-527]
- src/driver/mongodb/MongoDriver.ts[575-595]
- src/driver/DriverUtils.ts[250-307]
## Suggested approach
1. After options are fully built (post-URL-parse merge), detect presence of removed keys: `appname`, `fsync`, `j`, `useNewUrlParser`, `useUnifiedTopology`, `wtimeout`.
2. Throw a clear `TypeORMError` (or log a deprecation-removal warning) describing how to migrate.
3. (Optional) Add a small compatibility mapping for the non-nested equivalents where safe:
 - `appname` -> `appName`
 - `wtimeout` -> `wtimeoutMS`
 Keep `fsync`/`j` as hard errors (or map into `writeConcern` if you explicitly support that), but still warn/throw.
4. Add/adjust a test to assert that providing one of the removed options causes the expected warning/error.

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



Remediation recommended

3. Issue test not functional 📘 Rule violation ⛯ Reliability
Description
The PR updates MongoDB URL parsing coverage only in test/github-issues, not in test/functional
as required for issue-related test coverage. This risks regressions slipping past the functional
suite and violates the testing location policy.
Code

test/github-issues/7437/issue-7437.test.ts[R5-9]

describe("github issues > #7437 MongoDB options never parse in connectionUrl and after my fix was parse incorrect", () => {
   it("should parse options in ConnectionUrl", () => {
       const options = DriverUtils.buildMongoDBDriverOptions({
-            url: "mongodb://testuser:testpwd@test-primary.example.com:27017/testdb?retryWrites=true&w=majority&useUnifiedTopology=true",
+            url: "mongodb://testuser:testpwd@test-primary.example.com:27017/testdb?retryWrites=true&w=majority",
       })
Evidence
Compliance ID 3 requires issue fixes/coverage to live in test/functional, but the updated parsing
assertion remains in an issue-scoped test under test/github-issues/7437. The diff shows the
URL/options assertion being modified in that location rather than adding/updating a functional test.

Rule 3: Prefer functional tests over per-issue tests
test/github-issues/7437/issue-7437.test.ts[5-9]

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 modifies MongoDB URL parsing coverage only in `test/github-issues`, but the compliance requirement prefers issue fixes/coverage to be in the functional test suite.
## Issue Context
The updated test for MongoDB URL options parsing remains under `test/github-issues/7437`, which is discouraged as the primary/only validation location for behavioral changes.
## Fix Focus Areas
- test/github-issues/7437/issue-7437.test.ts[5-34]

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


4. URI migration guidance gap 🐞 Bug ✓ Correctness
Description
The migration guide recommends replacing removed options with nested writeConcern/camelCase keys,
but it doesn’t clarify what to do for connection-string-only setups where TypeORM only parses flat
query params and does not translate aliases/casing.
Code

docs/docs/guides/8-migration-v1.md[R94-108]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
+
Evidence
TypeORM’s MongoDB URL parser copies query parameters as flat key/value pairs without alias
translation, and MongoDriver only forwards allowlisted keys. Therefore, URI users who previously
used appname/wtimeout/j/fsync in the query string will see them dropped, and the guide
doesn’t explicitly call out the URI-specific replacements (e.g., appName=... or wtimeoutMS=...)
or the need to move these settings into object options.

docs/docs/guides/8-migration-v1.md[94-108]
src/driver/DriverUtils.ts[250-307]
src/driver/mongodb/MongoDriver.ts[575-595]

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 lists replacements for removed MongoDB connection options, but it doesn’t explicitly explain how to migrate if a user configures MongoDB exclusively via the connection string query params. In TypeORM, URI query params are parsed as a flat map and aliases/casing are not translated.
## Issue Context
- `parseMongoDBConnectionUrl()` copies query params as-is into a flat object.
- Only allowlisted keys are forwarded to the MongoDB driver.
- Some replacements in the guide are expressed as nested objects (`writeConcern: { ... }`), which users cannot represent directly in a URI.
## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[94-108]
- src/driver/DriverUtils.ts[250-307]
## Suggested doc improvements
1. Add a short note under the table like:
 - "If you configure MongoDB via a URI query string, use `appName` (camelCase) and `wtimeoutMS` (not `wtimeout`) as query params, or move write concern options into `DataSource` options."
2. Provide a URI example:
 - `mongodb://.../db?retryWrites=true&w=majority&appName=myapp&wtimeoutMS=2500`
3. For `j`/`fsync`, explicitly say they cannot be migrated via URI query params in TypeORM and should be expressed via `writeConcern` in the DataSource options.

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


5. URI migration guidance gap 🐞 Bug ✓ Correctness
Description
The migration guide recommends replacing removed options with nested writeConcern/camelCase keys,
but it doesn’t clarify what to do for connection-string-only setups where TypeORM only parses flat
query params and does not translate aliases/casing.
Code

docs/docs/guides/8-migration-v1.md[R94-108]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
+
Evidence
TypeORM’s MongoDB URL parser copies query parameters as flat key/value pairs without alias
translation, and MongoDriver only forwards allowlisted keys. Therefore, URI users who previously
used appname/wtimeout/j/fsync in the query string will see them dropped, and the guide
doesn’t explicitly call out the URI-specific replacements (e.g., appName=... or wtimeoutMS=...)
or the need to move these settings into object options.

docs/docs/guides/8-migration-v1.md[94-108]
src/driver/DriverUtils.ts[250-307]
src/driver/mongodb/MongoDriver.ts[575-595]

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 lists replacements for removed MongoDB connection options, but it doesn’t explicitly explain how to migrate if a user configures MongoDB exclusively via the connection string query params. In TypeORM, URI query params are parsed as a flat map and aliases/casing are not translated.
## Issue Context
- `parseMongoDBConnectionUrl()` copies query params as-is into a flat object.
- Only allowlisted keys are forwarded to the MongoDB driver.
- Some replacements in the guide are expressed as nested objects (`writeConcern: { ... }`), which users cannot represent directly in a URI.
## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[94-108]
- src/driver/DriverUtils.ts[250-307]
## Suggested doc improvements
1. Add a short note under the table like:
- "If you configure MongoDB via a URI query string, use `appName` (camelCase) and `wtimeoutMS` (not `wtimeout`) as query params, or move write concern options into `DataSource` options."
2. Provide a URI example:
- `mongodb://.../db?retryWrites=true&w=majority&appName=myapp&wtimeoutMS=2500`
3. For `j`/`fsync`, explicitly say they cannot be migrated via URI query params in TypeORM and should be expressed via `writeConcern` in the DataSource options.

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



Advisory comments

6. Changelog now misleading 🐞 Bug ✓ Correctness
Description
After documenting removal of useUnifiedTopology in the migration guide, the repo changelog still
states it was added as a supported config parameter, which may confuse upgrades and conflict with
the new guide.
Code

docs/docs/guides/8-migration-v1.md[R94-107]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
Evidence
The PR’s migration guide explicitly states useUnifiedTopology was removed, but the existing
changelog still advertises it as a config feature, which can send mixed signals to users reading
historical docs during upgrades.

docs/docs/guides/8-migration-v1.md[94-107]
CHANGELOG.md[1913-1918]

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

## Issue description
Migration docs now say `useUnifiedTopology` is removed, but CHANGELOG.md still contains an entry that it was added as a config parameter. While historically true, it becomes misleading in the context of upgrades.
## Issue Context
Users often consult CHANGELOG during upgrades; conflicting signals between the migration guide and changelog can slow debugging/migrations.
## Fix Focus Areas
- CHANGELOG.md[1913-1918]
- docs/docs/guides/8-migration-v1.md[94-107]
## Suggested approach
1. Add a short follow-up entry in an appropriate section (or a v1 changelog area) that explicitly states the option was removed in v1.
2. Optionally cross-link to the migration guide section for MongoDB deprecated options removal.

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


7. Changelog now misleading 🐞 Bug ✓ Correctness
Description
After documenting removal of useUnifiedTopology in the migration guide, the repo changelog still
states it was added as a supported config parameter, which may confuse upgrades and conflict with
the new guide.
Code

docs/docs/guides/8-migration-v1.md[R94-107]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
Evidence
The PR’s migration guide explicitly states useUnifiedTopology was removed, but the existing
changelog still advertises it as a config feature, which can send mixed signals to users reading
historical docs during upgrades.

docs/docs/guides/8-migration-v1.md[94-107]
CHANGELOG.md[1913-1918]

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

## Issue description
Migration docs now say `useUnifiedTopology` is removed, but CHANGELOG.md still contains an entry that it was added as a config parameter. While historically true, it becomes misleading in the context of upgrades.
## Issue Context
Users often consult CHANGELOG during upgrades; conflicting signals between the migration guide and changelog can slow debugging/migrations.
## Fix Focus Areas
- CHANGELOG.md[1913-1918]
- docs/docs/guides/8-migration-v1.md[94-107]
## Suggested approach
1. Add a short follow-up entry in an appropriate section (or a v1 changelog area) that explicitly states the option was removed in v1.
2. Optionally cross-link to the migration guide section for MongoDB deprecated options removal.

ⓘ 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

Grey Divider

Previous review results

Review updated until commit 35602a5

Results up to commit 35602a5


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

Grey Divider
Action required
1. Silent Mongo option drop 🐞 Bug ⛯ Reliability
Description
Removed MongoDB options are now silently ignored (not forwarded to the MongoDB driver) with no
validation/warning, which can change behavior for existing configs—especially write-concern related
options—and be very hard to diagnose.
Code

src/driver/mongodb/MongoDriver.ts[L211-218]

-        // Undocumented deprecated options
-        // todo: remove next major version
-        "appname",
-        "fsync",
-        "j",
-        "useNewUrlParser",
-        "useUnifiedTopology",
-        "wtimeout",
Evidence
MongoDriver only forwards allowlisted keys to MongoClient via buildConnectionOptions, while
validateOptions is effectively empty; after this PR, the removed keys are no longer allowlisted, so
they will be dropped without any user-visible warning/error.

src/driver/mongodb/MongoDriver.ts[160-211]
src/driver/mongodb/MongoDriver.ts[575-595]
src/driver/mongodb/MongoDriver.ts[521-527]
src/driver/DriverUtils.ts[250-307]

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 deprecated options were removed from the forwarding allowlist. Today, if users still provide these keys (either as top-level DataSource options in JS, or via MongoDB URL query params), TypeORM will silently ignore them because `buildConnectionOptions()` only forwards allowlisted keys and `validateOptions()` does nothing.
This creates a silent misconfiguration mode and may change behavior (notably for write concern-related options) without any diagnostics.
## Issue Context
- URL query params are parsed into a flat object and merged into driver options.
- Only keys in `validOptionNames` are forwarded to the MongoDB driver.
- The PR removed several keys from `validOptionNames`, so they are now dropped.
## Fix Focus Areas
- src/driver/mongodb/MongoDriver.ts[160-211]
- src/driver/mongodb/MongoDriver.ts[521-527]
- src/driver/mongodb/MongoDriver.ts[575-595]
- src/driver/DriverUtils.ts[250-307]
## Suggested approach
1. After options are fully built (post-URL-parse merge), detect presence of removed keys: `appname`, `fsync`, `j`, `useNewUrlParser`, `useUnifiedTopology`, `wtimeout`.
2. Throw a clear `TypeORMError` (or log a deprecation-removal warning) describing how to migrate.
3. (Optional) Add a small compatibility mapping for the non-nested equivalents where safe:
 - `appname` -> `appName`
 - `wtimeout` -> `wtimeoutMS`
 Keep `fsync`/`j` as hard errors (or map into `writeConcern` if you explicitly support that), but still warn/throw.
4. Add/adjust a test to assert that providing one of the removed options causes the expected warning/error.

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



Remediation recommended
2. Issue test not functional 📘 Rule violation ⛯ Reliability ⭐ New
Description
The PR updates MongoDB URL parsing coverage only in test/github-issues, not in test/functional
as required for issue-related test coverage. This risks regressions slipping past the functional
suite and violates the testing location policy.
Code

test/github-issues/7437/issue-7437.test.ts[R5-9]

describe("github issues > #7437 MongoDB options never parse in connectionUrl and after my fix was parse incorrect", () => {
    it("should parse options in ConnectionUrl", () => {
        const options = DriverUtils.buildMongoDBDriverOptions({
-            url: "mongodb://testuser:testpwd@test-primary.example.com:27017/testdb?retryWrites=true&w=majority&useUnifiedTopology=true",
+            url: "mongodb://testuser:testpwd@test-primary.example.com:27017/testdb?retryWrites=true&w=majority",
        })
Evidence
Compliance ID 3 requires issue fixes/coverage to live in test/functional, but the updated parsing
assertion remains in an issue-scoped test under test/github-issues/7437. The diff shows the
URL/options assertion being modified in that location rather than adding/updating a functional test.

Rule 3: Prefer functional tests over per-issue tests
test/github-issues/7437/issue-7437.test.ts[5-9]

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 modifies MongoDB URL parsing coverage only in `test/github-issues`, but the compliance requirement prefers issue fixes/coverage to be in the functional test suite.

## Issue Context
The updated test for MongoDB URL options parsing remains under `test/github-issues/7437`, which is discouraged as the primary/only validation location for behavioral changes.

## Fix Focus Areas
- test/github-issues/7437/issue-7437.test.ts[5-34]

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


3. URI migration guidance gap 🐞 Bug ✓ Correctness
Description
The migration guide recommends replacing removed options with nested writeConcern/camelCase keys,
but it doesn’t clarify what to do for connection-string-only setups where TypeORM only parses flat
query params and does not translate aliases/casing.
Code

docs/docs/guides/8-migration-v1.md[R94-108]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
+
Evidence
TypeORM’s MongoDB URL parser copies query parameters as flat key/value pairs without alias
translation, and MongoDriver only forwards allowlisted keys. Therefore, URI users who previously
used appname/wtimeout/j/fsync in the query string will see them dropped, and the guide
doesn’t explicitly call out the URI-specific replacements (e.g., appName=... or wtimeoutMS=...)
or the need to move these settings into object options.

docs/docs/guides/8-migration-v1.md[94-108]
src/driver/DriverUtils.ts[250-307]
src/driver/mongodb/MongoDriver.ts[575-595]

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 lists replacements for removed MongoDB connection options, but it doesn’t explicitly explain how to migrate if a user configures MongoDB exclusively via the connection string query params. In TypeORM, URI query params are parsed as a flat map and aliases/casing are not translated.
## Issue Context
- `parseMongoDBConnectionUrl()` copies query params as-is into a flat object.
- Only allowlisted keys are forwarded to the MongoDB driver.
- Some replacements in the guide are expressed as nested objects (`writeConcern: { ... }`), which users cannot represent directly in a URI.
## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[94-108]
- src/driver/DriverUtils.ts[250-307]
## Suggested doc improvements
1. Add a short note under the table like:
 - "If you configure MongoDB via a URI query string, use `appName` (camelCase) and `wtimeoutMS` (not `wtimeout`) as query params, or move write concern options into `DataSource` options."
2. Provide a URI example:
 - `mongodb://.../db?retryWrites=true&w=majority&appName=myapp&wtimeoutMS=2500`
3. For `j`/`fsync`, explicitly say they cannot be migrated via URI query params in TypeORM and should be expressed via `writeConcern` in the DataSource options.

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



Advisory comments
4. Changelog now misleading 🐞 Bug ✓ Correctness
Description
After documenting removal of useUnifiedTopology in the migration guide, the repo changelog still
states it was added as a supported config parameter, which may confuse upgrades and conflict with
the new guide.
Code

docs/docs/guides/8-migration-v1.md[R94-107]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
Evidence
The PR’s migration guide explicitly states useUnifiedTopology was removed, but the existing
changelog still advertises it as a config feature, which can send mixed signals to users reading
historical docs during upgrades.

docs/docs/guides/8-migration-v1.md[94-107]
CHANGELOG.md[1913-1918]

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

## Issue description
Migration docs now say `useUnifiedTopology` is removed, but CHANGELOG.md still contains an entry that it was added as a config parameter. While historically true, it becomes misleading in the context of upgrades.
## Issue Context
Users often consult CHANGELOG during upgrades; conflicting signals between the migration guide and changelog can slow debugging/migrations.
## Fix Focus Areas
- CHANGELOG.md[1913-1918]
- docs/docs/guides/8-migration-v1.md[94-107]
## Suggested approach
1. Add a short follow-up entry in an appropriate section (or a v1 changelog area) that explicitly states the option was removed in v1.
2. Optionally cross-link to the migration guide section for MongoDB deprecated options removal.

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


Grey Divider Grey Divider
Results up to commit 52bfb9c


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

Grey Divider
Action required
1. Silent Mongo option drop 🐞 Bug ⛯ Reliability
Description
Removed MongoDB options are now silently ignored (not forwarded to the MongoDB driver) with no
validation/warning, which can change behavior for existing configs—especially write-concern related
options—and be very hard to diagnose.
Code

src/driver/mongodb/MongoDriver.ts[L211-218]

-        // Undocumented deprecated options
-        // todo: remove next major version
-        "appname",
-        "fsync",
-        "j",
-        "useNewUrlParser",
-        "useUnifiedTopology",
-        "wtimeout",
Evidence
MongoDriver only forwards allowlisted keys to MongoClient via buildConnectionOptions, while
validateOptions is effectively empty; after this PR, the removed keys are no longer allowlisted, so
they will be dropped without any user-visible warning/error.

src/driver/mongodb/MongoDriver.ts[160-211]
src/driver/mongodb/MongoDriver.ts[575-595]
src/driver/mongodb/MongoDriver.ts[521-527]
src/driver/DriverUtils.ts[250-307]

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 deprecated options were removed from the forwarding allowlist. Today, if users still provide these keys (either as top-level DataSource options in JS, or via MongoDB URL query params), TypeORM will silently ignore them because `buildConnectionOptions()` only forwards allowlisted keys and `validateOptions()` does nothing.

This creates a silent misconfiguration mode and may change behavior (notably for write concern-related options) without any diagnostics.

## Issue Context
- URL query params are parsed into a flat object and merged into driver options.
- Only keys in `validOptionNames` are forwarded to the MongoDB driver.
- The PR removed several keys from `validOptionNames`, so they are now dropped.

## Fix Focus Areas
- src/driver/mongodb/MongoDriver.ts[160-211]
- src/driver/mongodb/MongoDriver.ts[521-527]
- src/driver/mongodb/MongoDriver.ts[575-595]
- src/driver/DriverUtils.ts[250-307]

## Suggested approach
1. After options are fully built (post-URL-parse merge), detect presence of removed keys: `appname`, `fsync`, `j`, `useNewUrlParser`, `useUnifiedTopology`, `wtimeout`.
2. Throw a clear `TypeORMError` (or log a deprecation-removal warning) describing how to migrate.
3. (Optional) Add a small compatibility mapping for the non-nested equivalents where safe:
  - `appname` -> `appName`
  - `wtimeout` -> `wtimeoutMS`
  Keep `fsync`/`j` as hard errors (or map into `writeConcern` if you explicitly support that), but still warn/throw.
4. Add/adjust a test to assert that providing one of the removed options causes the expected warning/error.

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



Remediation recommended
2. URI migration guidance gap 🐞 Bug ✓ Correctness
Description
The migration guide recommends replacing removed options with nested writeConcern/camelCase keys,
but it doesn’t clarify what to do for connection-string-only setups where TypeORM only parses flat
query params and does not translate aliases/casing.
Code

docs/docs/guides/8-migration-v1.md[R94-108]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
+
Evidence
TypeORM’s MongoDB URL parser copies query parameters as flat key/value pairs without alias
translation, and MongoDriver only forwards allowlisted keys. Therefore, URI users who previously
used appname/wtimeout/j/fsync in the query string will see them dropped, and the guide
doesn’t explicitly call out the URI-specific replacements (e.g., appName=... or wtimeoutMS=...)
or the need to move these settings into object options.

docs/docs/guides/8-migration-v1.md[94-108]
src/driver/DriverUtils.ts[250-307]
src/driver/mongodb/MongoDriver.ts[575-595]

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 lists replacements for removed MongoDB connection options, but it doesn’t explicitly explain how to migrate if a user configures MongoDB exclusively via the connection string query params. In TypeORM, URI query params are parsed as a flat map and aliases/casing are not translated.

## Issue Context
- `parseMongoDBConnectionUrl()` copies query params as-is into a flat object.
- Only allowlisted keys are forwarded to the MongoDB driver.
- Some replacements in the guide are expressed as nested objects (`writeConcern: { ... }`), which users cannot represent directly in a URI.

## Fix Focus Areas
- docs/docs/guides/8-migration-v1.md[94-108]
- src/driver/DriverUtils.ts[250-307]

## Suggested doc improvements
1. Add a short note under the table like:
  - "If you configure MongoDB via a URI query string, use `appName` (camelCase) and `wtimeoutMS` (not `wtimeout`) as query params, or move write concern options into `DataSource` options."
2. Provide a URI example:
  - `mongodb://.../db?retryWrites=true&w=majority&appName=myapp&wtimeoutMS=2500`
3. For `j`/`fsync`, explicitly say they cannot be migrated via URI query params in TypeORM and should be expressed via `writeConcern` in the DataSource options.

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



Advisory comments
3. Changelog now misleading 🐞 Bug ✧ Quality
Description
After documenting removal of useUnifiedTopology in the migration guide, the repo changelog still
states it was added as a supported config parameter, which may confuse upgrades and conflict with
the new guide.
Code

docs/docs/guides/8-migration-v1.md[R94-107]

+## MongoDB
+
+### Deprecated connection options removed
+
+The following MongoDB connection options have been removed:
+
+| Removed option       | Action                                           |
+| -------------------- | ------------------------------------------------ |
+| `appname`            | Use `appName` (camelCase) instead                |
+| `fsync`              | Use `writeConcern: { journal: true }` instead    |
+| `j`                  | Use `writeConcern: { journal: true }` instead    |
+| `useNewUrlParser`    | Remove — no-op since MongoDB Driver v4.0         |
+| `useUnifiedTopology` | Remove — no-op since MongoDB Driver v4.0         |
+| `wtimeout`           | Use `writeConcern: { wtimeoutMS: 2500 }` instead |
Evidence
The PR’s migration guide explicitly states useUnifiedTopology was removed, but the existing
changelog still advertises it as a config feature, which can send mixed signals to users reading
historical docs during upgrades.

docs/docs/guides/8-migration-v1.md[94-107]
CHANGELOG.md[1913-1918]

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

## Issue description
Migration docs now say `useUnifiedTopology` is removed, but CHANGELOG.md still contains an entry that it was added as a config parameter. While historically true, it becomes misleading in the context of upgrades.

## Issue Context
Users often consult CHANGELOG during upgrades; conflicting signals between the migration guide and changelog can slow debugging/migrations.

## Fix Focus Areas
- CHANGELOG.md[1913-1918]
- docs/docs/guides/8-migration-v1.md[94-107]

## Suggested approach
1. Add a short follow-up entry in an appropriate section (or a v1 changelog area) that explicitly states the option was removed in v1.
2. Optionally cross-link to the migration guide section for MongoDB deprecated options removal.

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


Grey Divider Grey Divider
Qodo Logo
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 80.273%. first build
when pulling 52bfb9c on refactor/remove-deprecated-mongodb-options
into 905efe2 on master.

@pkuczynski pkuczynski merged commit a84e993 into master Mar 6, 2026
19 checks passed
@pkuczynski pkuczynski deleted the refactor/remove-deprecated-mongodb-options branch March 6, 2026 23:24
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Persistent review updated to latest commit 35602a5

1 similar comment
@qodo-free-for-open-source-projects
Copy link
Copy Markdown

Persistent review updated to latest commit 35602a5

@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

4 participants