Indicates that if a property is represented as a document itself, the document fields are directly included in top document, rather than nesting it.
Indicates that if a property is represented as a document itself, the document fields are directly included in top document, rather than nesting it.
case class Range(start: Int, end: Int) case class LabelledRange( name: String, @Flatten range: Range) // Flattened BSONDocument("name" -> "foo", "start" -> 0, "end" -> 1) // Rather than: // BSONDocument("name" -> "foo", "range" -> BSONDocument( // "start" -> 0, "end" -> 1))
Ignores a field
Ignores a field
Specify a key different from field name in your case class.
Specify a key different from field name in your case class.
Convenient to use when you'd like to leverage mongo's _id
index
but don't want to actually use _id
in your code.
case class Website(@Key("_id") url: String)
Generated handler will map the url
field in your code
to _id
field in BSON
the desired key to use in BSON
Indicates that if an Option
property is empty,
it will be represented by BSONNull
rather than being omitted.
Indicates that if an Option
property is empty,
it will be represented by BSONNull
rather than being omitted.
case class Foo( title: String, @NoneAsNull description: Option[String])
Annotations to use on case classes that are being processed by macros.