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

Support BsonIgnore annotation for Scala case classes

    • Type: Icon: New Feature New Feature
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.0
    • Affects Version/s: None
    • Component/s: Scala
    • None

      Goal: Add a way to ignore BSON serialization of a case class field.

      Context**: We don't want to store into MongoDB some case class fields (eg. computed from other sources or used for binary serialization). But we don't want (sometimes we can't) wrap them into Option (eg. to avoid things like Option[Seq[T]]).

       

      I saw Java Driver has a BsonIgnore annotation, could it be possible to implement it ? It can cause issues for types that have no default constructor or default value but it could be prerequisite ?

      For example

      case class Picture(
                          height: Int,
                          width: Int,
                          @BsonIgnore
                          metadata: Seq[Metadata] = Seq.empty
                        )

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            gael.ferrachat@newsbridge.io Gaël Ferrachat
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: