update

abstract fun update(builder: (T) -> T)(source)

Updates the document by applying builder to the current value, preserving untouched fields. The baseline is the current value, or the type's defaults when the document is absent. The read-modify-write runs under the document's write lock.

Return the new value from the builder, idiomatically via copy(): update { current -> current.copy(name = "…") }.