each

open fun each(vararg values: V)(source)

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")
}
}
)

You can also call push multiple times:

collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push "123"
User::tokens push "456"
}
)

External resources


abstract fun each(values: Iterable<V>)(source)

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"))
}
}
)

You can also call push multiple times:

collection.updateOne(
filter = {
User::name eq "Bob"
},
update = {
User::tokens push "123"
User::tokens push "456"
}
)

External resources