Decoding Fields 

instances of the trait DecodeBsonField are used to extract values from DBObject. various instances are already provided in DecodeBsonFields

import io.github.raptros.bson._
import scalaz.\/-
import Bson._ 

val dbo = DBO("int-key" :> 35)

val v = implicitly[DecodeBsonField[Int]].decode("int-key", dbo)
//alternatively
val v = implicitly[DecodeBsonField[Int]]("int-key", dbo)

v === \/-(35)
Extractor syntax 

The implicit class DBOWrapper is provided in Extractors; among others methods, it provides field.

val dbo = DBO("doubleKey" :> 33.2)

dbo.field[Double]("doubleKey")
v === \/-(33.2)

it also provides fieldOpt:

val dbo = DBO("k1": true)

val v0 = dbo.fieldOpt[Boolean]("k1")
v0 === \/-(Some(true))

val v1 = dbo.fieldOpt[Boolean]("k2")
v1 === \/-(None)

val v2 = dbo.fieldOpt[Double]("k1)
v2 === -\/(NonEmptyList(WrongFieldType("k1",
  classOf[java.lang.Double],
  classOf[java.lang.Boolean])))
Deriving new instances 

hopefully, you will not need to do this too often (for reasons explained in the next section), but there are several ways to derive new instances.