weekUS

open val <R : Any> Value<R, Instant>.weekUS: Value<R, Int>(source)
open val <R : Any> Field<R, Instant>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfObjectId")
val <R : Any> Value<R, ObjectId>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfObjectId")
val <R : Any> Field<R, ObjectId>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfObjectId")
val <R : Any> KProperty1<R, ObjectId>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfObjectId")
val ObjectId.weekUS: Value<Any, Int>(source)
@get:JvmName(name = "weekUSOfTimestamp")
val <R : Any> Value<R, Timestamp>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfTimestamp")
val <R : Any> Field<R, Timestamp>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfTimestamp")
val <R : Any> KProperty1<R, Timestamp>.weekUS: Value<R, Int>(source)
@get:JvmName(name = "weekUSOfTimestamp")
val Timestamp.weekUS: Value<Any, Int>(source)

Returns the week of the year for a date, ranging from 0 to 53.

Weeks begin on Sundays, and week 1 begins with the first Sunday of the year. Days preceding the first Sunday of the year are in week 0.

The accepted date types are Instant, ObjectId and Timestamp.

Example

class User(
val name: String,
val birthdate: Instant,
val birthweekUS: Int? = null,
)

users.updateManyWithPipeline {
set {
User::birthweekUS set User::birthdate.weekUS
}
}

External resources