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

invalid variable names generated for mongo command when using reflection and list filtering

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 3.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • Fully Compatible
    • Dotnet Drivers
    • Not Needed
    • None
    • None
    • None
    • None
    • None
    • None

      Summary

      invalid variable names generated for mongo command when using reflection and list filtering

      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

      when using the mongo db library LinqProvider.V3 to filter based on a inner list and additional using projection some invalid variable names are created.

      the library uses LinqProvider.V3 to generate the mongo commands from linq and the generated query  has a '' at the start of the variable for some reason, that result in an exception: "Command aggregate failed: invalid $project :: cause by :::'s0' starts with an invalid character for a user variable name".

      without the '' the query works perfectly._

      Additional Background

      we are using the hot chocolate library to provide our mongo db instance and when we are using the use projection and filtering on a list field in the document we are fetching.

            Assignee:
            robert@mongodb.com Robert Stam
            Reporter:
            roei910@gmail.com רועי דניאל
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              None
              None
              None
              None