Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-3273

Ability to configure replacement for dot in a Map<String, Object>

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Codecs
    • None

      Background

      There are multiple ways to store a nested document in mongodb with dot in field names.

      1. Serialize the whole document as a string and store it.
      2. Since MongoDB have restrictions on only top level fields containing dot, we can wrap the entire document in another document whose only field name doesn't have a dot. While returning data, we can always query internal document of interest and return it.

      But the important abilities we might loose are querying and patching of nested fields.

      To be able to retain these two, we might have to replace dot character with some decent character sequence and persist it. Today, there is no easy way to specify a replacement for dot in codecs.

      For e.g. Spring data for mongodb provides an easy way to do this:

      Documentation:

      https://docs.spring.io/spring-data/mongodb/docs/current/api/org/springframework/data/mongodb/core/convert/MappingMongoConverter.html#setMapKeyDotReplacement-java.lang.String-

       

      Ask

      It would be good to provide an easy knob to set replacement for special characters(dot and dollar to start with) and all the codecs should replace those special characters in the property names.

       

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            satyaprakash1729@gmail.com Satyaprakash Reddy
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: