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

Casing not handled properly after array all-positional operator with camel case convention

    • Type: Icon: Bug Bug
    • Resolution: Unresolved
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: Builders, Write Operations
    • Labels:
      None

      I use the CamelCaseElementNameConvention. I'm attempting to remove an old field nested inside of some arrays. The CSharp driver will translate a query in Pascal case down to camelCase for me in most cases without issue. However, the following does not work for me:

       

      collection.UpdateManyAsync(Builders<Thing>.Filter.Exist("Job.Stuff.DeeperStuff"), Builders<Thing>.Update.Unset("Job.Stuff.$[].DeeperStuff.$[].Id"));

      This produces a MongoBulkWriteException: "The path 'job.stuff.0.DeeperStuff' must exist in the document in order to apply array updates.'" Note the capital D on DeeperStuff. In order to make this work, I currently must write my update document using camelCase and the exact field names after the $[] like:

      collection.UpdateManyAsync(Builders<Thing>.Filter.Exist("Job.Stuff.DeeperStuff"), Builders<Thing>.Update.Unset("Job.Stuff.$[].deeperStuff.$[]._id"));
      

      It seems somehow the $[] causes the driver to stop applying the conventions to the remaining path

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            ben@gdsestimating.com Ben Zuill-Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: