Skip to content

MongoDB request DSLopensavvy.ktmongo.dsl.aggregation.operatorsTypeValueOperatorstype

type

open val <R : Any> Value<R, *>.type: Value<R, ERROR CLASS: Symbol not found for BsonType>

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.