Allow Mongo collection reads into a Scala case class to use the class member default value for a missing collection field

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Scala
    • None
    • Environment:
      Ubuntu 16.04
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Currently  with  2.2.1 and higher, a case class that is registered can denote possible missing fields as Option[field]. Sometimes we have default values on case classes and it would be good if a collection can be read into a case class so the missing fields are replaced by the defaults

      for example: 

      case class Reg (name: String, mark: Int, loc: String, date: Date = new Date())

      collection Registration {"name": "David", "mark": 75, "loc": "The Gragg" }

      I would like the collection Registration to be read into Reg as

      Reg("David", 75, "The Gragg", new Date())

            Assignee:
            Unassigned
            Reporter:
            Edem Nsefik
            None
            Votes:
            2 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: