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

LINQ3: Refactor string StartsWith/Contains/EndsWith to use regular expressions in filters

    XMLWordPrintableJSON

Details

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

    Description

      Earlier (see CSHARP-3445) we decided to use $expr to translate filter expressions that use the string StartsWith/Contains/EndsWith methods.

      That decision made sense in one way because we already had support for those methods in the aggregation language.

      But we have since realized that it would be better to use regular expressions after all because they can use indexes. In some cases the server can scan only a range of the index, but even when it can't use a range, it can still scan the index instead of the collection to evaluate the filter.

      Additionally, the StartsWith/Contains/EndsWith methods may be preceded by some combination of ToLower/ToUpper/Trim/TrimStart/TrimEnd and those modifiers will affect the final regular expression.

      Attachments

        Activity

          People

            robert@mongodb.com Robert Stam
            robert@mongodb.com Robert Stam
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: