unordered

open fun unordered(isUnordered: Boolean = true)(source)

Specifies whether the operations in this bulk are independent.

If the operations are ordered, they are executed in the same order as they are specified. If an operation fails, the remaining ones are not executed.

If the operations are not ordered, they run in parallel in an arbitrary order. If an operation fails, the remaining ones are still executed.

Example

class User(
val name: String,
val age: Int,
)

collection.insertMany(
User("John", 25),
User("Jane", 30),
options = { unordered() },
)

See also

Negation of this operator.