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