dayOfYear
Returns the day of the year for a date as a number between 1 and 366.
The year starts on January 1st, so January 1st is day 1, and December 31st is day 365 (or 366 in a leap year).
The accepted date types are Instant, ObjectId and Timestamp.
Example
class User(
val name: String,
val birthdate: Instant,
val birthdayOfYear: Int? = null,
)
users.updateManyWithPipeline {
set {
User::birthdayOfYear set User::birthdate.dayOfYear
}
}Content copied to clipboard