type

open val <R : Any> Value<R, *>.type: Value<R, <Error class: unknown class>>(source)

Gets the BsonType of the current value.

Example

class User(
val name: String,
val age: Int,
)

collection.aggregate()
.project {
Field.unsafe<Boolean>("nameIsString") set (of(User::name).type eq of(BsonType.String))
}

External resources

See also

BsonType

List of possible types.