Uploaded image for project: 'C# Driver'
  1. C# Driver
  2. CSHARP-4100

Review uses of StringComparison in StartsWith, Contains and EndsWith

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 2.15.1
    • Affects Version/s: None
    • Component/s: LINQ3
    • None

      EqualsMethodToAggregationExpressionTranslator considers StringComparison.CurrentCulture and StringComparison.Ordinal to be equivalent. StartsWithContainsOrEndsWithMethodToAggregationExpressionTranslator considers StringComparison.CurrentCulture to be supported and all other StringComparison values throw ExpressionNotSupportedException. We should review our uses of StringComparison to ensure that they are consistent across the driver.

      Note that neither CurrentCulture nor Ordinal truly captures the server semantics. The server does not have an equivalent to Ordinal. Even CurrentCulture isn't quite right as many server functions such as $toLower only have well-defined behaviours for strings of ASCII characters. So we will have to make a design decision regarding how best to represent StringComparison values when translating to MQL or whether we should throw ExpressionNotSupportedExceptions.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            james.kovacs@mongodb.com James Kovacs
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: