LinqV3 Expression Not Supported: True

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      When assigning a true literal/primative

      .Project(
          augmentedProductType => new ProductTypeSearchResult
          {
              isSomething = true 
          }
      )
      

       
      And InvalidOperationException results with the message "Expression not supported: True"

      This also occurs when using a where clause in nested select within the project (although the case may be more general than that)

       .Project(
          augmentedProductType => new ProductTypeSearchResult
          {
              Description = augmentedProductType.ExternalProductTypeDescription,
              ProductTypeId = augmentedProductType.ProductTypeId,
              Name = augmentedProductType.Name,
              ProductFamilyId = augmentedProductType.ProductFamilyId,
              Url = augmentedProductType.ShopUrl ?? augmentedProductType.TypeUrl,
              Score = augmentedProductType.Score,
              Products = augmentedProductType.Products
                  .Select(
                      productForSelect => new ProductSearchResult
                      {
                          ProductId = productForSelect.ProductId,
                          ProductInfo = productForSelect.ProductInfo,
                          Deliveries = augmentedProductType
                              .Deliveries 
                              .Where(
                                  deliveryForWhere =>
                                      deliveryForWhere.ProductId ==
                                      productForSelect
                                          .ProductId)
                              .Select(
                                  deliveryForSelect =>
                                      new DeliverySearchResult
                                      {
                                          DeliveryId = deliveryForSelect.DeliveryId,
                                          Language = deliveryForSelect.Language,
                                          Platform = deliveryForSelect.Platform,
                                          OperatingSystem = deliveryForSelect.OperatingSystem,
                                          ReleaseInfo = deliveryForSelect.ReleaseInfo
                                      })
                      })
                  // THIS WHERE CLAUSE CAUSES THE ERROR
                  .Where(
                      productSearchResult => productSearchResult.Deliveries != null )

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

      Driver version 2.4.1

      How to Reproduce

      Steps to reproduce. If possible, please include a Short, Self Contained, Correct (Compilable), Example.

      Additional Background

      Please provide any additional background information that may be helpful in diagnosing the bug.

      Stack

      MongoDB.Driver.Linq.ExpressionNotSupportedException: Expression not supported: True.
         at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ToFilterFieldTranslators.ExpressionToFilterFieldTranslator.Translate(TranslationContext context, Expression expression)
         at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.TranslateUsingQueryOperators(TranslationContext context, Expression expression) 

       

            Assignee:
            Boris Dogadov
            Reporter:
            Rich Collette
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: