feat(mongodb): add db.getCollectionInfos() support#51
Merged
Conversation
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request adds support for db.getCollectionInfos() to the MongoDB shell parser, enabling the parser to recognize this MongoDB method with optional filter and options arguments.
Changes:
- Added a new lexer token
GET_COLLECTION_INFOSfor thegetCollectionInfoskeyword - Added a new grammar rule
getCollectionInfosin the parser to support zero, one, or two arguments - Updated all generated parser and lexer files (visitor, listener, base implementations) to include the new rule
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| mongodb/MongoShellLexer.g4 | Added GET_COLLECTION_INFOS token definition |
| mongodb/MongoShellParser.g4 | Added getCollectionInfos production rule with optional arguments support |
| mongodb/mongoshell_lexer.go | Generated lexer with new token constants and lexer rules |
| mongodb/mongoshell_parser.go | Generated parser with new context, visitor methods, and parsing logic |
| mongodb/mongoshellparser_visitor.go | Added VisitGetCollectionInfos method to visitor interface |
| mongodb/mongoshellparser_listener.go | Added Enter/Exit methods for getCollectionInfos production |
| mongodb/mongoshellparser_base_visitor.go | Added base implementation of VisitGetCollectionInfos |
| mongodb/mongoshellparser_base_listener.go | Added base implementation of Enter/Exit for getCollectionInfos |
| mongodb/parser_test.go | Added three test cases covering different argument scenarios |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
db.getCollectionInfos()support to MongoDB shell parserdb.getCollectionInfos(),db.getCollectionInfos({ name: "users" }),db.getCollectionInfos({}, { nameOnly: true })Test plan
db.getCollectionInfos()variants🤖 Generated with Claude Code