A BSON value that can be seen as a boolean.
Conversions:
number = 0 ~> false
number != 0 ~> true
boolean
undefined ~> false
null ~> false
import scala.util.Success
import reactivemongo.api.bson.{ BSONBooleanLike, BSONDocument, BSONInteger }
val bi = BSONInteger(1)
assert(bi.asTry[BSONBooleanLike].flatMap(_.toBoolean) == Success(true))
val doc = BSONDocument("field" -> bi)
assert(doc.getAsTry[BSONBooleanLike]("field").
flatMap(_.toBoolean) == Success(true))
- Companion:
- object
class Object
trait Matchable
class Any