CodecConfig

io.github.mbannour.mongo.codecs.CodecConfig
case class CodecConfig(noneHandling: NoneHandling, discriminatorField: String)

Configuration for BSON codec generation behavior.

This configuration object encapsulates all codec generation options, making the API more type-safe and extensible than using boolean flags.

Value parameters

discriminatorField

Field name used to store type discriminators for sealed hierarchies (default: "_t"). ===Example Usage===

 val config = CodecConfig(
   noneHandling = NoneHandling.Ignore,
   discriminatorField = "_type"
 )
noneHandling

Strategy for handling None values in Option fields.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def shouldEncodeNone: Boolean

Returns true if None values should be encoded as BSON null.

Returns true if None values should be encoded as BSON null.

Attributes

def withDiscriminator(field: String): CodecConfig

Helper method to set discriminator field - fluent API for functional configuration.

Helper method to set discriminator field - fluent API for functional configuration.

Value parameters

field

The field name to use for type discriminators

Attributes

Example
 builder.configure(_.withDiscriminator("_type"))

Helper method to set None handling to Encode - fluent API for functional configuration.

Helper method to set None handling to Encode - fluent API for functional configuration.

Attributes

Example
 builder.configure(_.withEncodeNone)

Helper method to set None handling to Ignore - fluent API for functional configuration.

Helper method to set None handling to Ignore - fluent API for functional configuration.

Attributes

Example
 builder.configure(_.withIgnoreNone)

Inherited methods

def productElementNames: Iterator[String]

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

Attributes

Inherited from:
Product