reactivemongo.api.bson.KeyWriter
See theKeyWriter companion object
Mapping from a BSON string to T
. Used by scala.collection.Map handlers.
final class Foo(val v: String) extends AnyVal
val dict = Map[Foo, Int](
(new Foo("key") -> 1),
(new Foo("name") -> 2))
import reactivemongo.api.bson.KeyWriter
implicit def fooKeyWriter: KeyWriter[Foo] =
KeyWriter[Foo] { foo =>
"foo:" + foo.v
}
reactivemongo.api.bson.BSON.writeDocument(dict)
// Success = {'foo:key': 1, 'foo:name': 2}
Attributes
- Companion
- object
- Graph
-
- Supertypes
-
class Objecttrait Matchableclass Any
Members list
In this article