bsondocument

molly.core.syntax.bsondocument
See thebsondocument companion object
trait bsondocument

Syntactic sugar for the Java driver's BsonDocument class.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object all
object bsondocument

Members list

Type members

Classlikes

object BsonDocument

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type

Types

type BsonDocument = BsonDocument

Extensions

Extensions

extension (bsonDoc: BsonDocument)
def append(key: String, valueOpt: Option[BsonValue]): BsonDocument

Append an optional value with the given key to the document.

Append an optional value with the given key to the document.

Value parameters

key

The key field

valueOpt

An Option BsonValue(@see org.bson.BsonValue), only if the value is defined then the key value pair will be inserted into the BsonDocument

Attributes

Returns

this BsonDocument

def getOption[T <: BsonValue : ClassTag](key: String): Option[T]

Read the value from the BsonDocument using the key. If the key does not exist or the type of the value is not as expected, None will be returned

Read the value from the BsonDocument using the key. If the key does not exist or the type of the value is not as expected, None will be returned

Type parameters

T

the type parameter for the expected value

Value parameters

key

The key field

Attributes

Returns

optional value of type T

def setOption(key: String, value: Option[BsonValue]): BsonDocument

If the value is not None, the key value pair will be inserted into the BsonDocument. If the value is None, then the key field is going to be removed from the BsonDocument

If the value is not None, the key value pair will be inserted into the BsonDocument. If the value is None, then the key field is going to be removed from the BsonDocument

Value parameters

key

The key field

value

An Option BsonValue(@see org.bson.BsonValue)

Attributes

Returns

this BsonDocument