setToCurrentDate

abstract fun Field<T, <Error class: unknown class>?>.setToCurrentDate()(source)
open fun KProperty1<T, <Error class: unknown class>?>.setToCurrentDate()(source)

Sets this field to the current date.

If the field does not exist, this operator adds the field to the document.

Example

class User(
val name: String?,
val age: Int,
val modificationDate: Instant,
)

collection.filter {
User::name eq "Bob"
}.updateMany {
User::age set 18
User::modificationDate.setToCurrentDate()
}

External resources


abstract fun Field<T, <Error class: unknown class>?>.setToCurrentDate()(source)
open fun KProperty1<T, <Error class: unknown class>?>.setToCurrentDate()(source)

Sets this field to the current timestamp.

If the field does not exist, this operator adds the field to the document.

The time Timestamp is internal. Instant should be preferred. For more information, see Timestamp.

Example

class User(
val name: String?,
val age: Int,
val modificationDate: Timestamp,
)

collection.filter {
User::name eq "Bob"
}.updateMany {
User::age set 18
User::modificationDate.setToCurrentDate()
}

External resources