-
Type: Bug
-
Resolution: Unresolved
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: Builders, Write Operations
-
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