getRegularExpression

fun getRegularExpression(key: String, defaultValue: BsonRegularExpression): BsonRegularExpression

If the document does not contain the given key, return the given default value. Otherwise, gets the value of the key as a BsonRegularExpression.

Return

the value of the key as a BsonRegularExpression

Parameters

key

the key

defaultValue

the default value

Throws

if the document contains the key but the value is not of the expected type


fun getRegularExpression(key: String): BsonRegularExpression

Gets the value of the key if it is a BsonRegularExpression, or throws if not.

Return

the value of the key as a BsonRegularExpression

Parameters

key

the key

Throws

if the document does not contain the key or the value is not of the expected type