-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-4443: Add comprehensive dictionary LINQ support for all 3 representations #1804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
rstam
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I've only reviewed the tests, where I have a lot of suggestions about possible MQL for things you didn't implement or "better" MQL in some cases for things you did implement.
Please take all suggestions with a grain of salt. You may have reasons for thinking that what I think is "better" MQL might not actually be better.
I am postponing reviewing the implementation because if you accept many of the MQL suggestions you will need to make many changes to the implementation.
I will review the implementation after you have accepted/rejected the MQL suggestions.
|
|
||
| namespace MongoDB.Driver.Tests.Linq.Linq3Implementation.Jira | ||
| { | ||
| public class CSharp2509Tests : LinqIntegrationTest<CSharp2509Tests.ClassFixture> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was surprised that these tests were deleted, but Adelin says they duplicate new tests he added in CSharp4443Tests.cs.
We don't usually remove tests... why bother?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note to other reviewers: we have to manually verify that we haven't lost any test coverage as a result of deleting these tests.
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
tests/MongoDB.Driver.Tests/Linq/Linq3Implementation/Jira/CSharp4443Tests.cs
Outdated
Show resolved
Hide resolved
34f74ce to
fdb6fa7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends LINQ support for dictionary operations across all three BSON representations (Document, ArrayOfDocuments, and ArrayOfArrays). Previously, some operations like ContainsKey, ContainsValue, indexer access, and property access (Count, Keys, Values) only worked with the Document representation.
Key Changes:
- Extended
ContainsKeyandContainsValueto support ArrayOfDocuments and ArrayOfArrays representations - Added support for dictionary indexer access across all representations
- Implemented dictionary property access (Count, Keys, Values) for all representations
- Added support for KeyValuePair property access in array representation
- Removed obsolete test files that tested the previous limited functionality
Reviewed changes
Copilot reviewed 24 out of 25 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
CSharp4813Tests.cs |
Removed dictionary-specific test methods that tested unsupported scenarios |
CSharp4557Tests.cs |
Deleted entire test file for ContainsKey with Document representation only |
CSharp2509Tests.cs |
Deleted entire test file for ContainsValue with limited representation support |
MemberExpressionToFilterFieldTranslator.cs |
Added KeyValuePair member translation and validation for Dictionary collections |
ContainsValueMethodToFilterTranslator.cs |
Extended to support ArrayOfArrays representation |
ContainsMethodToFilterTranslator.cs |
Added dictionary Keys/Values Contains support |
ContainsKeyMethodToFilterTranslator.cs |
Extended to support ArrayOfDocuments and ArrayOfArrays representations |
AllOrAnyMethodToFilterTranslator.cs |
Added validation to reject All/Any on Document representation dictionaries |
GetItemMethodToAggregationExpressionTranslator.cs |
Implemented indexer access for all dictionary representations |
ContainsValueMethodToAggregationExpressionTranslator.cs |
Refactored to extract reusable translation method |
ContainsMethodToAggregationExpressionTranslator.cs |
Added dictionary Keys/Values Contains support in aggregation expressions |
ContainsKeyMethodToAggregationExpressionTranslator.cs |
Extended to support all dictionary representations |
MemberExpressionToAggregationExpressionTranslator.cs |
Added comprehensive dictionary and KeyValuePair property translation |
AstExpression.cs |
Added ArrayToObject helper method |
KeyValuePairSerializer.cs |
Added IKeyValuePairSerializerV2 interface with key/value serializer accessors |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
...ors/ExpressionToFilterTranslators/MethodTranslators/ContainsValueMethodToFilterTranslator.cs
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the tests on Keys and Values properties of Dictionaries into this file since I think the ticket csharp5779 should have tested them.
No description provided.