fun <reified T : Any> MongoCollection<T>.insertOne(document: String, options: InsertOneOptions = InsertOneOptions()): InsertOneResult!
(source)
Inserts the provided document. If the document is missing an identifier, the driver should generate one.
document
- the document to insert
options
- the options to apply to the operation
com.mongodb.MongoWriteException
- if the write failed due some other failure specific to the insert command
com.mongodb.MongoWriteConcernException
- if the write failed due being unable to fulfil the write concern
com.mongodb.MongoCommandException
- if the write failed due to document validation reasons
com.mongodb.MongoException
- if the write failed due some other failure
fun <reified T : Any> MongoCollection<T>.insertOne(clientSession: ClientSession, document: String, options: InsertOneOptions = InsertOneOptions()): InsertOneResult!
(source)
Inserts the provided document. If the document is missing an identifier, the driver should generate one.
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.MongoWriteException
- if the write failed due some other failure specific to the insert command
com.mongodb.MongoWriteConcernException
- if the write failed due being unable to fulfil the write concern
com.mongodb.MongoCommandException
- if the write failed due to document validation reasons
com.mongodb.MongoException
- if the write failed due some other failure