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

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

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Unknown Unknown
    • None
    • None
    • Codecs, Kotlin

    Description

      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

      Attachments

        Activity

          People

            ross@mongodb.com Ross Lawley
            ross@mongodb.com Ross Lawley
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: