each
Specifies the values to push to the array.
If this function is called multiple times, they are combined (keeping the calling order).
Example
class User(
val name: String,
val tokens: List<String>,
)
collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push {
each("123", "456")
}
}
)Content copied to clipboard
You can also call push multiple times:
collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push "123"
User::tokens push "456"
}
)Content copied to clipboard
External resources
Specifies the values to push to the array.
If this function is called multiple times, they are combined (keeping the calling order).
Example
class User(
val name: String,
val tokens: List<String>,
)
collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push {
each(listOf("123", "456"))
}
}
)Content copied to clipboard
You can also call push multiple times:
collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push "123"
User::tokens push "456"
}
)Content copied to clipboard