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

Linq3Implementation: MongoDB.Driver.Linq.ExpressionNotSupportedException : Exists

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.21.0
    • Component/s: API
    • 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?

      Summary

      The use of  Linq "Exists" in the query is not supported.

      MongoDB.Driver.Linq.ExpressionNotSupportedException: Expression not supported: p.OrganizationIds.Exists(o => (o == "045d9fd6-677d-4b9f-a288-4478e75c2da4")).
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.MethodCallExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.MethodCallExpression expression) [0x01419] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.ExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression) [0x00133] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.MethodTranslators.AnyMethodToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.MethodCallExpression expression) [0x000a4] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.MethodCallExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.MethodCallExpression expression) [0x011f3] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.ExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression) [0x00133] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.BinaryExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.BinaryExpression expression) [0x000c2] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToAggregationExpressionTranslators.ExpressionToAggregationExpressionTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression) [0x0010c] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.TranslateUsingAggregationOperators (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression) [0x00000] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression, System.Boolean exprOk) [0x0000b] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ExpressionToFilterTranslator.TranslateLambda (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.LambdaExpression lambdaExpression, MongoDB.Bson.Serialization.IBsonSerializer parameterSerializer, System.Boolean asRoot) [0x00093] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.WhereMethodToPipelineTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.MethodCallExpression expression) [0x0003e] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToPipelineTranslators.ExpressionToPipelineTranslator.Translate (MongoDB.Driver.Linq.Linq3Implementation.Translators.TranslationContext context, System.Linq.Expressions.Expression expression) [0x003a1] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToExecutableQueryTranslators.ExpressionToExecutableQueryTranslator.Translate[TDocument,TOutput] (MongoDB.Driver.Linq.Linq3Implementation.MongoQueryProvider`1[TDocument] provider, System.Linq.Expressions.Expression expression) [0x00015] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.Linq.Linq3Implementation.MongoQuery`2[TDocument,TOutput].ToCursorAsync (System.Threading.CancellationToken cancellationToken) [0x00000] in <23bc2c72d0e04efa9278964cb99d6993>:0 
        at MongoDB.Driver.IAsyncCursorSourceExtensions.ToListAsync[TDocument] (MongoDB.Driver.IAsyncCursorSource`1[TDocument] source, System.Threading.CancellationToken cancellationToken) [0x0000e] in <b1986f4c9c644071ac801bfae5975e5e>:0 
        at Infrastructure.Database.CosmoMongoDb.GetAccountsByOrganizationIdAsync (System.String organizationId) [0x001a7] in

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

      How to Reproduce

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

              var accounts = await AccountsCollection.AsQueryable().Where(a =>
                      a.Profiles != null &&
                      a.Profiles.Exists(p => p.OrganizationIds.Exists(o => o == organizationId))).ToListAsync()

       

       

      Additional Background

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

            Assignee:
            Unassigned Unassigned
            Reporter:
            sasan.pasha@gmail.com Sasan Pasha
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: