Query MongoDb sublists with C# LINQ regex

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.2.3
    • Component/s: LINQ
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      As posted here:
      http://stackoverflow.com/questions/35863999/query-mongodb-sublists-with-c-sharp-linq-regex

      Regex IsMatch does not seem to work on list-properties although the same LINQ query runs fine on a standard list.

      I.e. given

      public class Car

      { public string Name; public List<string> Colors; }

      this only works for plain list LINQ:

      var regex = new Regex("^Blue.*");
      var matchingCars = carCollection.Where(x => x.Colors.Any(y => regex.IsMatch));

      The above just silently returns an empty queryable.

            Assignee:
            Unassigned
            Reporter:
            Søren Holstebroe
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: