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

The Queryable translation for Contains converts to a non working regular expression.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Critical - P2 Critical - P2
    • None
    • 1.9
    • API
    • None
    • windows 2013

    Description

      When using this form of c# code (simplified):

      >> var collection = MongoDataConnection.GetCollection<T>(true);
      >> IQueryable<T> qyb = collection.AsQueryable();
      >> var cursor = qyb.Where( e=>e.Name.Contains(astring) ).AsQueryable();

      The resulting mongo command is converted to:

      >> collection.Find(

      {Name:/astring/s}

      )

      which fails with Invalid flags supplied to Regex constructor 's'
      This was also consuming 99% CPU on our servers. This problem has only just materialised.
      When in shell I run :

      >> collection.Find(

      {Name:/astring/s}

      )

      I still get the error - if I convert this to

      >> collection.Find({Name:{$regex:"astring",$options:"s"}})

      it works fine..

      This is a HUGE issue for us.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: