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

Camel case element name convention is not applied for extra element names

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • BSON
    • None

    Description

      I am not sure if it's bug, but in my opinion it is.

      I am using CamelCaseElementNameConvention and I am expecting that all names will be converted to camel case.

        var convensions = new ConventionPack
        {
          new CamelCaseElementNameConvention()
        };
       
        ConventionRegistry.Register("default", convensions, x => true);
      

      Lets say I have such class

      public class MyDocument {
       
        public string Name { get; set; }
       
        [BsonExtraElements]
        public AdditionalInfo AdditionalInfo { get; set; } 
        /* class AdditionalInfo implements IDictionary<string, object> */
      }
      

      Then this class is serialised and stored in database, it looks like this

        {
          "name": "Tom",
          "Age": 24,
          "Gender": "male"
        }
      

      I am expecting to have such result

        {
          "name": "Tom",
          "age": 24,
          "gender": "male"
        }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            gediminas.backevicius Gediminas Backevicius
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: