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

Nested or subproperties in Update.Set don't work in V3

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Blocker - P1 Blocker - P1
    • None
    • Affects Version/s: 2.21.0
    • Component/s: 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?

      Hi,
       
      we have a regression in 
      Builders<Class1>.Update.Set(x => x.Prop1.SubProp1, "someValue");
      We get an exception (see below) in LinqProvider V3. V2 works fine.
       
      Thanks!
       
      Best Regards
      Dimitri
       
      MongoDB.Driver.Linq.ExpressionNotSupportedException: Expression not supported: ConvertChecked(Param_0.Prop1.SubProp1, String).
      at MongoDB.Driver.Linq.Linq3Implementation.Translators.ExpressionToFilterTranslators.ToFilterFieldTranslators.ExpressionToFilterFieldTranslator.Translate(TranslationContext context, Expression expression)
      at MongoDB.Driver.Linq.Linq3Implementation.LinqProviderAdapterV3.TranslateExpressionToField[TDocument,TField](Expression`1 expression, IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, Boolean allowScalarValueForArrayField)
      at MongoDB.Driver.ExpressionFieldDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider, Boolean allowScalarValueForArrayField)
      at MongoDB.Driver.ExpressionFieldDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
      at MongoDB.Driver.OperatorUpdateDefinition`2.Render(IBsonSerializer`1 documentSerializer, IBsonSerializerRegistry serializerRegistry, LinqProvider linqProvider)
      at MongoDB.Driver.MongoCollectionImpl`1.ConvertWriteModelToWriteRequest(WriteModel`1 model, Int32 index)

        1. image-2023-08-31-10-22-53-005.png
          30 kB
          Dimitri Kroo
        2. TestProject1.7z
          13.54 MB
          Dimitri Kroo

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            dimitri.kroo@baramundi.com Dimitri Kroo
            Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: