package codecs
- Alphabetic
- By Inheritance
- codecs
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Package Members
- package macrocodecs
Type Members
- type BsonTypeClassMap = bson.codecs.BsonTypeClassMap
Type alias to the
BsonTypeClassMap
- type BsonTypeCodecMap = bson.codecs.BsonTypeCodecMap
Type alias to the
BsonTypeCodecMap
- case class DocumentCodecProvider() extends CodecProvider with Product with Serializable
A CodecProvider for the Document class and all the default Codec implementations on which it depends.
- case class ImmutableDocumentCodec(registry: Option[CodecRegistry]) extends CollectibleCodec[collection.immutable.Document] with Product with Serializable
A Codec for immutable Document instances.
A Codec for immutable Document instances.
As the underlying driver expects documents to be mutable the driver has direct access to the Documents underlying mutable
BsonDocument
instance and therefore will mutate the document when adding an_id
- case class IterableCodec(registry: CodecRegistry, bsonTypeClassMap: bson.codecs.BsonTypeClassMap, valueTransformer: Transformer) extends Codec[Iterable[_]] with Product with Serializable
Encodes and decodes
Iterable
objects.Encodes and decodes
Iterable
objects.- Annotations
- @SuppressWarnings()
- Since
1.2
- case class IterableCodecProvider(bsonTypeClassMap: BsonTypeClassMap, valueTransformer: Option[Transformer]) extends CodecProvider with Product with Serializable
A
CodecProvider
for classes than implement theIterable
interface.A
CodecProvider
for classes than implement theIterable
interface.- bsonTypeClassMap
the non-null
BsonTypeClassMap
with which to construct instances ofDocumentCodec
andListCodec
.- valueTransformer
the value transformer for decoded values
- Since
1.2
- case class MutableDocumentCodec(registry: Option[CodecRegistry]) extends CollectibleCodec[collection.mutable.Document] with Product with Serializable
A Codec for mutable Document instances.
Value Members
- object BsonTypeClassMap
Companion to return the default
BsonTypeClassMap
- object ImmutableDocumentCodec extends Serializable
Companion helper for immutable Document instances.
- object IterableCodec extends Serializable
IterableCodec companion object
IterableCodec companion object
- Since
1.2
- object IterableCodecProvider extends Serializable
IterableCodecProvider companion object
IterableCodecProvider companion object
- Since
1.2
- object Macros
Macro based Codecs
Macro based Codecs
Allows the compile time creation of Codecs for case classes.
The recommended approach is to use the implicit Macros.createCodecProvider[T](clazz:Class[T])* method to help build a codecRegistry:
import org.mongodb.scala.bson.codecs.Macros.createCodecProvider import org.bson.codecs.configuration.CodecRegistries.{fromRegistries, fromProviders}
case class Contact(phone: String) case class User(_id: Int, username: String, age: Int, hobbies: List[String], contacts: List[Contact])
val codecRegistry = fromRegistries(fromProviders(classOf[User], classOf[Contact]), MongoClient.DEFAULT_CODEC_REGISTRY)
- Since
2.0
- object MutableDocumentCodec extends Serializable
Companion helper for mutable Document instances.
This is the documentation for the MongoDB Scala driver.
Driver structure
The mongodb scala driver.
To get started you need a MongoClient instance, either from a connection string or via a org.mongodb.scala.MongoClientSettings.
Notable packages include: