MongoDB request DSL • opensavvy.ktmongo.dsl.aggregation.operators • ArrayValueOperators • takeLast
takeLast¶
Returns the last limit
elements in an array, similar to kotlin.collections.takeLast.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val lastScores: List<Int>,
)
players.updateManyWithPipeline {
set {
Player::lastScores set Player::scores.takeLast(3)
}
}
External resources¶
Returns the last limit
elements in an array, similar to kotlin.collections.takeLast.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val lastScores: List<Int>,
)
players.updateManyWithPipeline {
set {
Player::lastScores set Player::scores.takeLast(3)
}
}
External resources¶
Returns the last limit
elements in an array, similar to kotlin.collections.takeLast.
Example¶
class Player(
val _id: ObjectId,
val scores: List<Int>,
val lastScores: List<Int>,
)
players.updateManyWithPipeline {
set {
Player::lastScores set Player::scores.takeLast(3)
}
}