insertMany
abstract suspend fun insertMany(documents: Iterable<Document>, options: ERROR CLASS: Symbol not found for 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
Note that insertOne ignores filtered collection. That is, insertOne on a filtered collection behaves exactly the same as the same insertOne on the underlying real collection.
External resources
See also
Insert a single document.
open suspend fun insertMany(vararg documents: Document, options: ERROR CLASS: Symbol not found for 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
Note that insertOne ignores filtered collection. That is, insertOne on a filtered collection behaves exactly the same as the same insertOne on the underlying real collection.
External resources
See also
Insert a single document.