kmongo / org.litote.kmongo.coroutine / CoroutineCollection / insertOne

insertOne

suspend fun insertOne(document: T, options: InsertOneOptions = InsertOneOptions()): InsertOneResult (source)

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Parameters

document - the document to insert

options - the options to apply to the operation com.mongodb.DuplicateKeyException or com.mongodb.MongoException

Since
1.2

suspend fun insertOne(clientSession: ClientSession, document: T, options: InsertOneOptions = InsertOneOptions()): InsertOneResult (source)

Inserts the provided document. If the document is missing an identifier, the driver should generate one.

Parameters

clientSession - the client session with which to associate this operation

document - the document to insert

options - the options to apply to the operation com.mongodb.DuplicateKeyException or com.mongodb.MongoException

Mongodb
.server.release 3.6

Since
1.7