align mongo storage and vector connection strings and docs - #11728
Conversation
🦋 Changeset detectedLatest commit: 187a085 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughThis PR standardizes MongoDB connection naming by making Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (6)
stores/mongodb/src/storage/index.test.ts (1)
156-156: Fix references to TEST_CONFIG.url - should be TEST_CONFIG.uriMultiple test configurations throughout the file reference
TEST_CONFIG.url!, but TEST_CONFIG now only definesuri(line 25). This will cause runtime errors.🐛 Proposed fix
Update all references from
TEST_CONFIG.url!toTEST_CONFIG.uri!:url: TEST_CONFIG.url!, + url: TEST_CONFIG.uri!,This applies to lines: 156, 169, 174, 179, 251, 264, 277, 623, 649, 657, 667, 680, 714, 728, 740.
Also applies to: 169-169, 174-174, 179-179, 251-251, 264-264, 277-277, 623-623, 649-649, 657-657, 667-667, 680-680, 714-714, 728-728, 740-740
docs/src/content/en/reference/vectors/mongodb.mdx (1)
386-389: Add missingidfield to MongoDBVector initialization.The
MongoDBVectorconstructor requires anidfield (as shown in line 27 and in the implementation atstores/mongodb/src/vector/index.ts:73), but it's missing from this example.🐛 Proposed fix
vector: new MongoDBVector({ + id: 'mongodb-vector', uri: process.env.MONGODB_URI!, dbName: process.env.MONGODB_DB_NAME!, }),docs/src/content/en/reference/storage/mongodb.mdx (4)
36-59: Update Parameters table to documenturiinstead ofurl.The parameters table documents
urlbut the PR standardizes onuri. Update this table to reflect the new API, and optionally add a deprecatedurlentry for reference.📝 Suggested documentation fix
Update the first parameter entry:
{ - name: "url", + name: "id", type: "string", description: - "MongoDB connection string (e.g., mongodb+srv://user:password@cluster.mongodb.net)", + "Unique identifier for this storage instance", isOptional: false, }, { - name: "dbName", + name: "uri", type: "string", - description: "The name of the database you want the storage to use.", + description: + "MongoDB connection string (e.g., mongodb+srv://user:password@cluster.mongodb.net)", isOptional: false, }, + { + name: "dbName", + type: "string", + description: "The name of the database you want the storage to use.", + isOptional: false, + },
65-85: Update constructor examples to useuriinstead ofurl.These examples still use the old
urlparameter. Update them to useurifor consistency with the standardized API.📝 Suggested documentation fix
// Basic connection without custom options const store1 = new MongoDBStore({ - url: "mongodb+srv://user:password@cluster.mongodb.net", + id: 'mongodb-store', + uri: "mongodb+srv://user:password@cluster.mongodb.net", dbName: "mastra_storage", }); // Using connection string with options const store2 = new MongoDBStore({ - url: "mongodb+srv://user:password@cluster.mongodb.net", + id: 'mongodb-store', + uri: "mongodb+srv://user:password@cluster.mongodb.net", dbName: "mastra_storage", options: { retryWrites: true, maxPoolSize: 10, serverSelectionTimeoutMS: 5000, socketTimeoutMS: 45000, }, });
109-127: Update usage examples to useuriinstead ofurl.These examples still reference
MONGODB_URLenvironment variable and use theurlparameter. Update to useuriandMONGODB_URIfor consistency.📝 Suggested documentation fix
const storage = new MongoDBStore({ - url: process.env.MONGODB_URL, + id: 'mongodb-storage', + uri: process.env.MONGODB_URI, dbName: process.env.MONGODB_DATABASE, }); // ... later in the file ... const storage = new MongoDBStore({ id: 'mongodb-storage', - url: process.env.MONGODB_URL, + uri: process.env.MONGODB_URI, dbName: process.env.MONGODB_DATABASE, });
213-214: Update agent example to useuriinstead ofurl.This example still uses the old
urlparameter. Update to useurifor consistency.📝 Suggested documentation fix
storage: new MongoDBStore({ - url: process.env.MONGODB_URI!, + id: 'mongodb-storage', + uri: process.env.MONGODB_URI!, dbName: process.env.MONGODB_DB_NAME!, }),
🤖 Fix all issues with AI agents
In @docs/src/content/en/reference/storage/mongodb.mdx:
- Around line 28-30: The docs are inconsistent: examples use the new parameter
name uri while the Parameters table and many examples still reference url;
update the Parameters table to document uri as the primary connection option
(and mark url as deprecated-but-supported), add a short deprecation note about
url for backward compatibility, and replace every code sample and constructor
example that currently uses url with uri (including the Constructor Examples and
all usage snippets) so all examples consistently use uri and refer to url only
in the deprecation note.
🧹 Nitpick comments (2)
.changeset/quiet-points-brush.md (1)
5-5: Improve changeset clarity and add code examples.The current description could be clearer for developers and should include before/after examples to show the breaking change.
📝 Suggested improvement
-Fix MongoDB connection string parameter naming inconsistency. MongoDBVector now uses uri parameter (correct MongoDB terminology). MongoDBStore now accepts both uri (recommended) and url (deprecated, for backward compatibility). Added clear error messages when connection string is missing. +Fixed MongoDB connection string parameter naming. Both MongoDBVector and MongoDBStore now use `uri` for the connection string parameter. MongoDBStore maintains backward compatibility with `url` (deprecated). Connection string validation now provides clear error messages. + +**MongoDBVector - Breaking change:** +```ts +// Before +new MongoDBVector({ + url: process.env.MONGODB_URI, + dbName: 'mydb' +}) + +// After +new MongoDBVector({ + id: 'my-vector', + uri: process.env.MONGODB_URI, + dbName: 'mydb' +}) +``` + +**MongoDBStore - Backward compatible:** +```ts +// Recommended (new) +new MongoDBStore({ + id: 'my-store', + uri: process.env.MONGODB_URI, + dbName: 'mydb' +}) + +// Still works (deprecated) +new MongoDBStore({ + id: 'my-store', + url: process.env.MONGODB_URI, + dbName: 'mydb' +}) +```Based on coding guidelines, changeset files should include code examples for breaking changes or new features, show the before/after of the public API, and use direct, scannable formatting.
stores/mongodb/src/vector/index.ts (1)
76-78: Consider using MastraError for consistency.The URI validation throws a plain
Error, while all other error handling in this class usesMastraErrorwith proper error IDs, domains, and categories (see lines 97-105, 112-120, etc.). For consistency and better error handling, consider usingMastraErrorhere as well.♻️ Suggested refactor
if (!uri) { - throw new Error('MongoDBVector requires a connection string. Provide "uri" in the constructor options.'); + throw new MastraError({ + id: createVectorErrorId('MONGODB', 'CONSTRUCTOR', 'MISSING_URI'), + domain: ErrorDomain.STORAGE, + category: ErrorCategory.USER, + text: 'MongoDBVector requires a connection string. Provide "uri" in the constructor options.', + }); }
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
.changeset/quiet-points-brush.mddocs/src/content/en/docs/rag/vector-databases.mdxdocs/src/content/en/reference/storage/mongodb.mdxdocs/src/content/en/reference/vectors/mongodb.mdxstores/mongodb/README.mdstores/mongodb/src/storage/db/index.tsstores/mongodb/src/storage/index.test.tsstores/mongodb/src/storage/types.tsstores/mongodb/src/vector/index.test.tsstores/mongodb/src/vector/index.ts
🧰 Additional context used
📓 Path-based instructions (6)
**/*.ts?(x)
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts?(x): All packages use TypeScript with strict type checking
Use telemetry decorators for observability in component implementations
Support both sync and async operations where applicable in component implementations
Files:
stores/mongodb/src/vector/index.test.tsstores/mongodb/src/vector/index.tsstores/mongodb/src/storage/db/index.tsstores/mongodb/src/storage/types.tsstores/mongodb/src/storage/index.test.ts
**/*.test.ts?(x)
📄 CodeRabbit inference engine (CLAUDE.md)
Mock external services in unit tests rather than making real external calls
Files:
stores/mongodb/src/vector/index.test.tsstores/mongodb/src/storage/index.test.ts
**/*.{md,mdx}
📄 CodeRabbit inference engine (.cursor/rules/writing-documentation.mdc)
**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as these read like marketing copy and developers don't like that
When writing developer documentation, do not use 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations like 'Check out', 'Learn more', 'Explore'. Do not use words like 'essential' or 'offers'
When writing developer documentation, do not use 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution' as these are marketing jargon that developers dislike
When writing developer documentation, avoid phrasing like 'without changing your code' or 'automatically handles' that obscures implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details. Focus on technical specifics and implementation details rather than high-level benefits. For example, avoid sentences like: 'This makes it easy to build AI applications that maintain meaningful conversations and remember important details, whether you're building a simple chatbot or a sophisticated AI assistant'
All H1 headings (# Heading) must use title case format, capitalizing the first letter of each major word. Examples: 'Getting Started', 'Human In-the-Loop Workflow', 'Agent as a Step'
Files:
stores/mongodb/README.mddocs/src/content/en/docs/rag/vector-databases.mdxdocs/src/content/en/reference/vectors/mongodb.mdxdocs/src/content/en/reference/storage/mongodb.mdx
**/*.md
📄 CodeRabbit inference engine (CLAUDE.md)
Follow
.cursor/rules/writing-documentation.mdcfor documentation writing style: avoid marketing language like 'powerful', 'complete', 'out-of-the-box', 'your needs', 'production-ready', and 'makes it easy'; focus on technical details rather than benefits; write for engineers not marketing
Files:
stores/mongodb/README.md
**/*{docs,documentation}/**/*.{md,mdx}
📄 CodeRabbit inference engine (.windsurfrules)
**/*{docs,documentation}/**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as they read like marketing copy
When writing developer documentation, do not use words like 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations such as 'Check out', 'Learn more', 'Explore', 'essential', or 'offers'
When writing developer documentation, avoid marketing jargon such as 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution'
When writing developer documentation, do not use phrases like 'without changing your code' or 'automatically handles' as they glide over implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details; instead, focus on technical nuts and bolts with specific implementation details rather than abstract benefits
Files:
docs/src/content/en/docs/rag/vector-databases.mdxdocs/src/content/en/reference/vectors/mongodb.mdxdocs/src/content/en/reference/storage/mongodb.mdx
.changeset/*.md
⚙️ CodeRabbit configuration file
.changeset/*.md: Changeset files are really important for keeping track of changes in the project. They'll be used to generate release notes and inform users about updates.Review the changeset file according to these guidelines:
- The target audience are developers
- Write short, direct sentences that anyone can understand. Avoid commit messages, technical jargon, and acronyms. Use action-oriented verbs (Added, Fixed, Improved, Deprecated, Removed)
- Avoid generic phrases like "Update code", "Miscellaneous improvements", or "Bug fixes"
- Highlight outcomes! What does change for the end user? Do not focus on internal implementation details
- Add context like links to issues or PRs when relevant
- If the change is a breaking change or is adding a new feature, ensure that a code example is provided. This code example should show the public API usage (the before and after). Do not show code examples of internal implementation details.
- Keep the formatting easy-to-read and scannable. If necessary, use bullet points or multiple paragraphs (Use bold text as the heading for these sections, do not use markdown headings).
- For larger, more substantial changes, also answer the "Why" behind the changes
- Each changeset file contains a YAML frontmatter at the top. It will be one or more package names followed by a colon and the type of change (patch, minor, major). Do not modify this frontmatter. Check that the description inside the changeset file only applies to the packages listed in the frontmatter. Do not allow descriptions that mention changes to packages not listed in the frontmatter. In these cases, the user must create a separate changeset file for those packages.
In case of a guideline violation ALWAYS mark your comment as
potential_issue.
Files:
.changeset/quiet-points-brush.md
🧠 Learnings (2)
📚 Learning: 2025-11-24T16:42:04.244Z
Learnt from: CR
Repo: mastra-ai/mastra PR: 0
File: packages/codemod/AGENTS.md:0-0
Timestamp: 2025-11-24T16:42:04.244Z
Learning: Applies to packages/codemod/src/test/__fixtures__/**/*.ts : Create test fixtures by copying examples DIRECTLY from migration guides in `docs/src/content/en/guides/migrations/upgrade-to-v1/` without hallucinating or inventing changes
Applied to files:
stores/mongodb/src/vector/index.test.tsstores/mongodb/src/storage/index.test.ts
📚 Learning: 2025-11-24T16:42:04.244Z
Learnt from: CR
Repo: mastra-ai/mastra PR: 0
File: packages/codemod/AGENTS.md:0-0
Timestamp: 2025-11-24T16:42:04.244Z
Learning: Applies to packages/codemod/src/test/__fixtures__/**/*.ts : In output fixtures, ensure all NEGATIVE test cases remain EXACTLY IDENTICAL to their input fixture counterparts to verify the codemod only transforms intended patterns
Applied to files:
stores/mongodb/src/storage/index.test.ts
🧬 Code graph analysis (2)
stores/mongodb/src/vector/index.test.ts (1)
stores/mongodb/src/vector/index.ts (1)
MongoDBVector(59-865)
stores/mongodb/src/storage/index.test.ts (1)
stores/mongodb/src/storage/index.ts (1)
MongoDBStore(41-95)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
stores/mongodb/src/storage/index.test.ts (1)
29-60: LGTM! Comprehensive test coverage for the uri/url parameter handling.The new test suite properly validates:
- The recommended
uriparameter- Backward compatibility with deprecated
urlparameter- Clear error messaging when neither is provided
docs/src/content/en/docs/rag/vector-databases.mdx (1)
36-40: LGTM! Documentation properly reflects the updated API.The example correctly shows the new
idfield and usesurifor the connection string, aligning with the standardized naming.stores/mongodb/src/vector/index.test.ts (1)
5-36: LGTM! Comprehensive test coverage for MongoDBVector constructor.The tests properly validate:
- Standard MongoDB connection strings (
mongodb://)- MongoDB Atlas connection strings (
mongodb+srv://)- Clear error messaging when
uriis missingThe test structure is clear and follows existing patterns.
stores/mongodb/src/storage/db/index.ts (2)
37-47: LGTM! Solid implementation of uri/url fallback with clear error handling.The implementation:
- Correctly prioritizes
urioverurlwith fallback- Provides clear, actionable error message when connection string is missing
- Maintains backward compatibility
62-62: Good defensive error detail logging.Including both
uriandurlfields in error details aids debugging when configuration issues occur.stores/mongodb/src/storage/types.ts (1)
68-78: Connection string validation is properly handled in the implementation.Both
uriandurloptional fields are correctly validated:
- At least one is required:
resolveMongoDBConfigenforces this at line 38-47 (db/index.ts), throwingMISSING_URIif neither is provided- Precedence is clear:
uritakes priority with the??operator (line 38)- Both provided:
uriis used,urlis ignored as fallbackThe implementation correctly handles all edge cases, and the type definition appropriately allows both for backward compatibility during the deprecation period.
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
stores/mongodb/src/storage/index.test.ts (1)
93-127: Config validation tests should include uri-based valid configs.The valid configs array only includes
url-based configurations (lines 96, 102, 121). While these test backward compatibility, you should also add test cases using the newuriparameter to explicitly validate the preferred approach.➕ Add uri-based valid config tests
validConfigs: [ + { + description: 'URI/dbName config', + config: { id: 'test-store', uri: 'mongodb://localhost:27017', dbName: 'test-db' }, + }, + { + description: 'URI/dbName with options', + config: { + id: 'test-store', + uri: 'mongodb://localhost:27017', + dbName: 'test-db', + options: { maxPoolSize: 50, minPoolSize: 5 }, + }, + }, { description: 'URL/dbName config', config: { id: 'test-store', url: 'mongodb://localhost:27017', dbName: 'test-db' }, },
🧹 Nitpick comments (3)
docs/src/content/en/reference/storage/mongodb.mdx (1)
12-12: Avoid vague descriptor in documentation.The phrase "scalable storage solution" reads as a marketing claim without technical specifics. Consider rephrasing to focus on concrete capabilities.
✍️ Suggested alternative
-The MongoDB storage implementation provides a scalable storage solution using MongoDB databases with support for both document storage and vector operations. +The MongoDB storage implementation uses MongoDB databases and supports both document storage and vector operations.As per coding guidelines, avoid marketing language in developer documentation.
stores/mongodb/src/storage/index.test.ts (2)
128-144: Invalid config tests also need uri-based cases.Similar to the valid configs, the invalid configs should include test cases that use
uriinstead of only testing the deprecatedurlparameter (lines 131, 136, 141).➕ Add uri-based invalid config tests
invalidConfigs: [ + { + description: 'empty uri without connectorHandler', + config: { id: 'test-store', uri: '', dbName: 'test-db' }, + expectedError: /connection string|uri.*url/i, + }, { description: 'empty url without connectorHandler', config: { id: 'test-store', url: '', dbName: 'test-db' }, expectedError: /connection string|uri.*url/i, },
247-259: MongoDB-specific tests still use url parameter.While testing backward compatibility is valuable, these MongoDB-specific connection tests (lines 251, 264, 277) only use the deprecated
urlparameter. Consider adding equivalent tests usingurito validate the primary parameter works with these connection scenarios.➕ Add uri-based connection tests
Add tests that mirror these connection scenarios but use
uriinstead:it('should handle MongoDB Atlas connection strings with uri', () => { const atlasConfig = { id: 'mongodb-atlas-uri-test', uri: 'mongodb+srv://user:pass@cluster.mongodb.net/', dbName: 'test-db', options: { retryWrites: true, w: 'majority' as const, }, }; expect(() => new MongoDBStore(atlasConfig)).not.toThrow(); });
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
docs/src/content/en/reference/storage/mongodb.mdxstores/mongodb/src/storage/index.test.ts
🧰 Additional context used
📓 Path-based instructions (4)
**/*.ts?(x)
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.ts?(x): All packages use TypeScript with strict type checking
Use telemetry decorators for observability in component implementations
Support both sync and async operations where applicable in component implementations
Files:
stores/mongodb/src/storage/index.test.ts
**/*.test.ts?(x)
📄 CodeRabbit inference engine (CLAUDE.md)
Mock external services in unit tests rather than making real external calls
Files:
stores/mongodb/src/storage/index.test.ts
**/*.{md,mdx}
📄 CodeRabbit inference engine (.cursor/rules/writing-documentation.mdc)
**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as these read like marketing copy and developers don't like that
When writing developer documentation, do not use 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations like 'Check out', 'Learn more', 'Explore'. Do not use words like 'essential' or 'offers'
When writing developer documentation, do not use 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution' as these are marketing jargon that developers dislike
When writing developer documentation, avoid phrasing like 'without changing your code' or 'automatically handles' that obscures implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details. Focus on technical specifics and implementation details rather than high-level benefits. For example, avoid sentences like: 'This makes it easy to build AI applications that maintain meaningful conversations and remember important details, whether you're building a simple chatbot or a sophisticated AI assistant'
All H1 headings (# Heading) must use title case format, capitalizing the first letter of each major word. Examples: 'Getting Started', 'Human In-the-Loop Workflow', 'Agent as a Step'
Files:
docs/src/content/en/reference/storage/mongodb.mdx
**/*{docs,documentation}/**/*.{md,mdx}
📄 CodeRabbit inference engine (.windsurfrules)
**/*{docs,documentation}/**/*.{md,mdx}: When writing developer documentation, do not use adjectives like 'powerful' or 'built-in' as they read like marketing copy
When writing developer documentation, do not use words like 'complete', 'out-of-the-box', 'hands-on', or overly enthusiastic exhortations such as 'Check out', 'Learn more', 'Explore', 'essential', or 'offers'
When writing developer documentation, avoid marketing jargon such as 'your needs', 'production-ready', 'makes it easy', or 'choose the right...solution'
When writing developer documentation, do not use phrases like 'without changing your code' or 'automatically handles' as they glide over implementation details
In developer documentation, avoid phrasing that glides between benefits without diving into details; instead, focus on technical nuts and bolts with specific implementation details rather than abstract benefits
Files:
docs/src/content/en/reference/storage/mongodb.mdx
🧠 Learnings (1)
📚 Learning: 2025-11-24T16:42:04.244Z
Learnt from: CR
Repo: mastra-ai/mastra PR: 0
File: packages/codemod/AGENTS.md:0-0
Timestamp: 2025-11-24T16:42:04.244Z
Learning: Applies to packages/codemod/src/test/__fixtures__/**/*.ts : Create test fixtures by copying examples DIRECTLY from migration guides in `docs/src/content/en/guides/migrations/upgrade-to-v1/` without hallucinating or inventing changes
Applied to files:
stores/mongodb/src/storage/index.test.ts
🧬 Code graph analysis (1)
stores/mongodb/src/storage/index.test.ts (2)
stores/mongodb/src/storage/index.ts (2)
MongoDBStore(41-95)MemoryStorageMongoDB(16-16)stores/mongodb/src/storage/domains/memory/index.ts (1)
MemoryStorageMongoDB(27-899)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Validate build outputs
- GitHub Check: Lint
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (16)
docs/src/content/en/reference/storage/mongodb.mdx (7)
28-31: LGTM! Clear example with updated parameters.The basic usage example correctly demonstrates the new
uriparameter and includes theidfield. The change aligns with the PR objectives to standardize onurias the parameter name.
39-51: Good addition of deprecation information.The parameters table correctly lists
urias the primary parameter andurlas deprecated with backward compatibility support. The descriptions are clear and technical.
68-70: Clear deprecation notice.The deprecation notice appropriately informs users to use
uriin new code while maintaining backward compatibility forurl. The messaging is straightforward and actionable.
80-96: Examples correctly updated to use uri.Both constructor examples now use
uriinstead ofurl, demonstrating the recommended approach. The examples cover basic and advanced configurations appropriately.
120-147: Initialization section properly updated.All examples in the initialization section correctly use
uriand include theidfield where appropriate. The code examples are consistent with the API changes.
163-166: MongoDBVector example correctly updated.The vector store example now includes both
idanduriparameters, aligning with the standardization effort described in the PR objectives.
224-224: Agent memory example updated correctly.The agent configuration example uses
uriconsistently with the rest of the documentation updates.stores/mongodb/src/storage/index.test.ts (9)
25-25: LGTM! Test configuration updated correctly.The TEST_CONFIG now uses
uriinstead ofurl, aligning with the standardization effort.
29-60: Excellent test coverage for the issue fix.The new test suite comprehensively validates:
- Acceptance of the new
uriparameter- Backward compatibility with the deprecated
urlparameter- Clear error messaging when neither parameter is provided
The tests directly address GitHub issue #11697 and provide good regression protection.
64-64: MongoClient instantiation correctly updated.The createConnectorHandler helper now uses
TEST_CONFIG.urito create the MongoClient, consistent with the parameter name change.
156-159: Store creation updated correctly for client acceptance tests.The test now uses
urifrom TEST_CONFIG to create the store, consistent with the new parameter naming.
168-181: Domain creation helpers correctly updated.All three domain test helpers (MemoryStorageMongoDB, WorkflowsStorageMongoDB, ScoresStorageMongoDB) now use
uriinstead ofurl.
623-623: MongoClient creation in helper updated correctly.The mongoIndexExists helper now uses
TEST_CONFIG.urito create the MongoClient for index checking operations.
649-687: Store-level index tests correctly use uri.All store creation helpers for index testing (createDefaultStore, createStoreWithSkipDefaults, createStoreWithCustomIndexes, createStoreWithInvalidTable) consistently use
urifrom TEST_CONFIG.
713-747: Domain-level index tests correctly use uri.All domain creation helpers for index testing consistently use
urifrom TEST_CONFIG, maintaining consistency with the store-level tests.
52-59: The regex pattern/uri.*url|connection/icorrectly matches the actual error message thrown by the implementation:"MongoDBStore requires a connection string. Provide "uri" (recommended) or "url" in the constructor options."The pattern is appropriately designed, not overly broad. It matches both "uri" followed by "url" (the two parameter names) and "connection" (the context of the validation), which are both present in the actual error message. There are no unintended error messages in the code path that would be incorrectly matched by this pattern.
Likely an incorrect or invalid review comment.
…#11728) ## Description Fix MongoDB connection string parameter inconsistency between `MongoDBVector` and `MongoDBStore`. - Standardize on `uri` as the parameter name (correct MongoDB terminology) - Add `url` as a deprecated fallback on `MongoDBStore` for backward compatibility - Add clear error messages when connection string is missing - Export `MongoDBVectorConfig` interface for better TypeScript DX - Update all documentation to use `uri` ## Related Issue(s) Fixes mastra-ai#11697 ## Type of Change - [x] Bug fix (non-breaking change that fixes an issue) - [ ] New feature (non-breaking change that adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [x] Documentation update - [ ] Code refactoring - [ ] Performance improvement - [x] Test update ## Checklist - [x] I have made corresponding changes to the documentation (if applicable) - [x] I have added tests that prove my fix is effective or that my feature works <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added optional id parameter for MongoDB storage and vector instances to identify instances. * **Chores** * Standardized MongoDB connection option to use uri as the primary field; url is deprecated but still supported for backward compatibility. * Improved error messages and documentation/examples to clarify missing or misconfigured MongoDB connection strings. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
Description
Fix MongoDB connection string parameter inconsistency between
MongoDBVectorandMongoDBStore.urias the parameter name (correct MongoDB terminology)urlas a deprecated fallback onMongoDBStorefor backward compatibilityMongoDBVectorConfiginterface for better TypeScript DXuriRelated Issue(s)
Fixes #11697
Type of Change
Checklist
Summary by CodeRabbit
New Features
Chores
✏️ Tip: You can customize this high-level summary in your review settings.