Allow bson-kotlin to support default values where the value is null

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Codecs, Kotlin
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Kotlin supports default values, in data classes where a field is non nullable and has a default value then the default value should be used if the database contains nulls

      data class Item(val name:String, val category:String = "default")
      
      // This data will error
      { name: "item2", category: null }
      

      A PR has been submitted reporting this issue: https://github.com/mongodb/mongo-java-driver/pull/1260

              Assignee:
              Nabil Hachicha
              Reporter:
              Ross Lawley
              None
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: