[Workers] Add MongoDB integration docs#31382
Conversation
|
This pull request requires reviews from CODEOWNERS as it changes files that match the following patterns:
|
There was a problem hiding this comment.
3 issues need fixing before merge.
HIGH — Workers TypeScript examples must use TypeScriptExample (not bare ts/typescript fences). I suggested the most prominent blocks; please apply the same wrapper to any remaining examples on both pages.
HIGH — WranglerConfig blocks must use TOML input and $today for compatibility_date instead of JSONC/hardcoded dates.
MEDIUM — The tutorial output block should use txt output rather than sh output.
|
Review posted on PR #31382. Labels applied: Summary of findings:
I posted 11 inline suggestions covering the import additions, representative No pre-existing issues in unchanged files were flagged. The content is technically accurate and the structure is solid once the component/style-guide violations are resolved. |
…ngodb.mdx Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
…ngodb.mdx Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
…ngodb.mdx Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
…ngodb.mdx Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: ask-bonk[bot] <249159057+ask-bonk[bot]@users.noreply.github.com>
Close TypeScriptExample and WranglerConfig blocks that were missing fence/tag terminators, and fill in the empty example blocks in the MongoDB integration page and Atlas tutorial.
Review🚨 2 critical, Code ReviewThis code review is in beta and may not always be helpful — use your judgment. Critical (2)
Warnings (2)
Style Guide ReviewWarnings (7)
Suggestions (3)
CommandsOnly codeowners can run commands. Post a comment with the command to trigger it.
|
Summary
Adds documentation for connecting Cloudflare Workers to MongoDB using the native Node.js driver (
mongodb >= 6.15.0) and Mongoose. We occasionally get requests in discord for information on how to do this since we don't support these drivers in Hyperdrive, and setting up database connections on a request-basis is inefficient.Three changes:
New integration page at
/workers/databases/third-party-integrations/mongodb/– covers both a direct connection (simple, ~300ms overhead per request) and a Durable Object approach (recommended, persists connections for ~35ms warm queries). Also documents the Mongoosepackage.jsonexports patch required for workerd compatibility.Table row added to
/workers/databases/connecting-to-databases/under the serverless databases section, listing MongoDB with themongodb/mongoosedrivers and TCP Socket as the connection method.New tutorial at
/workers/tutorials/connect-to-mongodb-atlas/– a step-by-step guide that creates a Worker, connects to MongoDB, queries a sample collection, then upgrades to a Durable Object for lower latency.Relevant upstream context:
node:netnode:tlsTLSSocketDocumentation checklist