reactivemongo.api.bson.Macros.Annotations
Indicates a default value for a class property, when there is no corresponding BSON value when reading.
It enables a behaviour similar to MacroOptions.ReadDefaultValues, without requiring the define a global default value for the property.
import reactivemongo.api.bson.BSONDocument import reactivemongo.api.bson.Macros, Macros.Annotations.DefaultValue case class Foo( title: String, @DefaultValue(1.23D) score: Double) val reader = Macros.reader[Foo] reader.readTry(BSONDocument("title" -> "Bar")) // No BSON 'score' // Success: Foo(title = "Bar", score = 1.23D)
Indicates a default value for a class property, when there is no corresponding BSON value when reading.
It enables a behaviour similar to MacroOptions.ReadDefaultValues, without requiring the define a global default value for the property.