Skip to content

Add MongoDB Atlas Local support#1396

Merged
cristianrgreco merged 6 commits into
testcontainers:mainfrom
jbl428:feat/mongodb-atlas-local
Jul 1, 2026
Merged

Add MongoDB Atlas Local support#1396
cristianrgreco merged 6 commits into
testcontainers:mainfrom
jbl428:feat/mongodb-atlas-local

Conversation

@jbl428

@jbl428 jbl428 commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
  • Add MongoDBAtlasLocalContainer to the MongoDB module
  • Support Atlas Local connection strings and optional credentials
  • Add Atlas Search example coverage and module exports
  • Document Atlas Local usage alongside the existing MongoDB docs

@netlify

netlify Bot commented Jul 1, 2026

Copy link
Copy Markdown

Deploy Preview for testcontainers-node ready!

Name Link
🔨 Latest commit ffe34f6
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-node/deploys/6a4500c4cfafb30009b3a576
😎 Deploy Preview https://deploy-preview-1396--testcontainers-node.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cristianrgreco cristianrgreco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work — mirrors testcontainers-java's MongoDBAtlasLocalContainer and correctly relies on the managed image. Main asks: credentialed connection strings are missing authSource=admin (and no test actually authenticates), and the test image should be pinned in the Dockerfile. Rest is inline.

Keeping this as its own container instead of a flag on MongoDBContainer is the right call — different image, different internals, and matches java/go.

Comment thread packages/modules/mongodb/src/mongodb-atlas-local-container.ts
Comment thread packages/modules/mongodb/src/mongodb-atlas-local-container.test.ts
Comment thread packages/modules/mongodb/src/mongodb-atlas-local-container.test.ts Outdated
Comment thread docs/modules/mongodb.md Outdated
Comment thread packages/modules/mongodb/src/mongodb-atlas-local-container.test.ts Outdated
Comment thread packages/modules/mongodb/src/mongodb-atlas-local-container.ts
@cristianrgreco cristianrgreco added enhancement New feature or request minor Backward compatible functionality labels Jul 1, 2026
jbl428 added 5 commits July 1, 2026 20:45
Rename `## Examples` to `## MongoDBContainer` and `## MongoDB Atlas Local`
to `## MongoDBAtlasLocalContainer` so both containers are peer H2 sections
whose headings match their exported class names.
The root user is created in the admin database, so connection strings that
carry credentials must authenticate against it. Add an authenticated test
that inserts a document to cover the behavior.
Add the Atlas Local image as a second FROM line and read it via
getImage(__dirname, 1) instead of hardcoding the tag, so Renovate keeps
it up to date.
The Atlas Local image uses MONGODB_INITDB_* rather than the MONGO_INITDB_*
used by mongodb-container.ts; add a comment so it is not "fixed" to match
the sibling file.
Keep the marker inside the it() body like the other snippets in the file,
so the generated doc example excludes the test wrapper and try/finally.

@cristianrgreco cristianrgreco left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All feedback addressed — authSource=admin is now set for credentialed connection strings and covered by a test that actually authenticates against the /test database, the Atlas image is pinned in the Dockerfile, and the docs/codeinclude structure is consistent. Nice work. LGTM.

@cristianrgreco cristianrgreco merged commit a7d6ef4 into testcontainers:main Jul 1, 2026
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request minor Backward compatible functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants