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

Review uses of StringComparison in StartsWith, Contains and EndsWith

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 2.15.1
    • None
    • LINQ3
    • None

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: