Skip to content

Document MongoDB URI normalization behavior - #164

Closed
cursor[bot] wants to merge 3 commits into
mainfrom
cursor/docs-mongodb-uri-normalization-220b
Closed

cursor[bot] wants to merge 3 commits into
mainfrom
cursor/docs-mongodb-uri-normalization-220b

Conversation

@cursor

@cursor cursor Bot commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Updates contributor-facing documentation for MongoDB URI normalization and Prisma datasource handling.

Stacked on PR #155 (cursor/harden-mongodb-uri-2b9a). The feature branch is available only as a PR ref, so this PR targets the default branch and will become documentation-only after PR #155 lands.

Docs added/updated

  • .env.example comments for DATABASE_URL alignment
  • docs/configuration.md production toggle and MongoDB URI rules
  • docs/database.md Prisma runtime URI resolution/runbook details
  • docs/engineering-guide.md setup and persistence notes
  • docs/getting-started.md Prisma generation and MongoDB troubleshooting
  • docs/contributing.md setup quick start and current test inventory

Codepaths covered

  • src/utils/resolveMongoUri.js
  • src/handlers/prisma.js
  • src/example.config.js
  • MongoDB/Prisma regression tests in tests/

Key knowledge gaps addressed

  • Runtime process.env.DATABASE_URL sync before PrismaClient construction
  • Empty MongoDB database paths and config.variables.dbName appending
  • Replica-set host lists and encoded credential preservation
  • Strict PRODUCTION === "true" environment selection
  • Missing explicit npx prisma generate step and current resolver test coverage

Verification

  • git diff --cached --check
  • npm test (61/61 passing)
Open in Web View Automation 

cursoragent and others added 3 commits September 13, 2026 09:44
new URL() rejects standard replica-set connection strings such as
mongodb://host1:27017,host2:27017/db, causing a startup crash when
resolveMongoUri runs at module load. URL.toString() also re-encodes
credentials when appending a database name.

Use string-based path extraction and append logic instead, and add
tests for replica-set URIs and encoded credentials.

Co-authored-by: Daan Vrieling <contact@zvapor.xyz>
Set process.env.DATABASE_URL to the resolved MongoDB URI so Prisma
schema env("DATABASE_URL") and the client datasourceUrl stay aligned,
preventing P1013 when the env var is empty or lacks a db path.

Add tests for double-slash avoidance, replica-set query params, and
DATABASE_URL sync ordering. Document URI/dbName alignment in AGENTS.md,
.env.example, and engineering-guide.md.

Co-authored-by: Daan Vrieling <contact@zvapor.xyz>
Co-authored-by: Daan Vrieling <contact@zvapor.xyz>
@zVapor-Dev
zVapor-Dev marked this pull request as ready for review September 16, 2026 22:51
@zVapor-Dev zVapor-Dev closed this Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants