Translation of Regex.IsMatch fails if the pattern is not a constant

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Dotnet Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      See EF-247 for details. May be related to CSHARP-4698.

      Driver-only repro:

      var client = new MongoClient("mongodb://localhost:27017");
      var database = client.GetDatabase("db221");
      database.DropCollection("Orders");
      
      var collection = database.GetCollection<Order>("Orders");
      collection.InsertMany([new Order { Id = 1, Foo = "X", Bar = "X" }, new Order { Id = 2, Foo = "Y", Bar = "Y" }]);
      
      var value = collection.AsQueryable().Where(o => Regex.IsMatch(o.Foo, o.Bar)).ToList();
      Console.WriteLine(value.Count);
      
      public class Order
      {
          public int Id { get; set; }
          public string Foo { get; set; }
          public string Bar { get; set; }
      }
      

              Assignee:
              Unassigned
              Reporter:
              Arthur Vickers
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: