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

Case insensitive search using $in clause in Linq expressions

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.3
    • Component/s: Linq
    • None

      Hi guys,

      It would be very useful to support case insensitive search using $in clause in Linq expressions. For example it might be done in this way:

      Unable to find source-code formatter for language: csharp. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      var goodValues = new string[] { ... }
      var query = collection.AsQueryable<T>()
          .Where(i => goodValues.Contains(i.SomeField.ToLower()));
      

      Right now it's only possible to specify general values in the array and is not possible to specify regex values for case insensitive search. General equal clause suports it via ToLower() etc methods, but the driver throw an exception if there is a call of .ToLower() method inside the array.Contains() method in .Where() expression.

      Thanks,
      Mikhail

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            mbelov Mikhail Belov
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: