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

oDATA $matchesPattern support with LINQ3

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Unknown Unknown
    • None
    • None
    • None
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

    Description

      Summary

      MongoDB.Driver.Linq.ExpressionNotSupportedException
        HResult=0x80131515
        Message=Expression not supported: (IIF((Convert($it.Gene, String) == null), null, Convert(IsMatch(Convert($it.Gene, String), "(^|\;)KIR2DL2(\;|$)", ECMAScript), Nullable`1)) == True).
        Source=MongoDB.Driver
        StackTrace: 
         於 MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.MethodTranslators.StringExpressionToRegexFilterTranslator.TranslateComparisonExpression(TranslationContext context, Expression expression, Expression leftExpression, AstComparisonFilterOperator comparisonOperator, Expression rightExpression) 在 /_/src/MongoDB.Driver/Linq/Linq3Implementation/Translators/ExpressionToFilterTranslators/ExpressionTranslators/StringExpressionToRegexFilterTranslator.cs:行 305 中

      Please provide the version of the driver. If applicable, please provide the MongoDB server version and topology (standalone, replica set, or sharded cluster).

      "Microsoft.AspNetCore.OData" Version="8.0.12"

      "MongoDB.Driver" Version="2.20.0"

      MongoDB 5.0.6 Community

      How to Reproduce

      http://localhost:5163/odata/Analysis/Detail?$filter=matchesPattern(Gene,'(^|\;)KIR2DL2(\;|$)')

      Additional Background

      expression debug view
      .If ((System.String)$$it.Gene == null)

      {     null }

      .Else

      {     (System.Nullable`1[System.Boolean]).Call System.Text.RegularExpressions.Regex.IsMatch(         (System.String)$$it.Gene,         "(^|\;)KIR2DL2(\;|$)",         .Constant<System.Text.RegularExpressions.RegexOptions>(ECMAScript)) }

      == .Constant<System.Nullable`1[System.Boolean]>(True)

      Attachments

        Activity

          People

            oleksandr.poliakov@mongodb.com Oleksandr Poliakov
            fo40225@hotmail.com Ching Hsu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: