
com.avsystem.commons.mongo.reactive.GenCodecCollection.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons-mongo_2.13 Show documentation
Show all versions of commons-mongo_2.13 Show documentation
AVSystem commons library for Scala
The newest version!
package com.avsystem.commons
package mongo.reactive
import com.avsystem.commons.mongo.core.GenCodecRegistry
import com.avsystem.commons.serialization.GenCodec
import com.mongodb.reactivestreams.client.{MongoCollection, MongoDatabase}
object GenCodecCollection {
def create[T: GenCodec : ClassTag](db: MongoDatabase, name: String,
legacyOptionEncoding: Boolean = GenCodecRegistry.LegacyOptionEncoding): MongoCollection[T] = {
val newRegistry = GenCodecRegistry.create[T](db.getCodecRegistry, legacyOptionEncoding)
db.withCodecRegistry(newRegistry).getCollection(name, classTag[T].runtimeClass.asInstanceOf[Class[T]])
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy