insertMany
abstract suspend fun insertMany(documents: Iterable<Document>, options: InsertManyOptions<Document>.() -> Unit = {})(source)
Inserts multiple documents in a single operation.
Example
class User(
val name: String,
val age: Int,
)
collection.insertMany(users)Content copied to clipboard
Filtered collections
Insert operations ignore the configured filter: the document will be inserted even if it does not match the filter.
External resources
See also
Insert a single document.
open suspend fun insertMany(vararg documents: Document, options: InsertManyOptions<Document>.() -> Unit = {})(source)
Inserts multiple documents in a single operation.
Example
class User(
val name: String,
val age: Int,
)
collection.insertMany(
User(name = "Bob", age = 18),
User(name = "Alice", age = 17)
)Content copied to clipboard
Filtered collections
Insert operations ignore the configured filter: the document will be inserted even if it does not match the filter.
External resources
See also
Insert a single document.