insertOne

inline suspend fun <T : Any> MongoCollection<T>.insertOne(document: T): Any

Insert a single object into the remote collection.

Return

the _id value of the document insert in the collection deserialized to the most appropriate type.

Parameters

document

the object to serialize and insert into the remote collection.

Throws

if the underlying App Service HTTP requests fails.

SerializationException

if document could not be serialized into a EJson document or if the App Service response could not be parsed into a reasonable type.