toUuid

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

Converts a string value to a Uuid (BsonType.BinaryData).

Example

class User(
val _id: ObjectId,
val eventId: Uuid,
)

// Convert old 'eventId' data which was incorrectly created as strings
users.updateManyWithPipeline {
set {
User::eventId set of(User::eventId).toUuid()
}
}

External resources

See also

Get the value's type.