withDocumentClass

abstract fun <NewTDocument : Any> withDocumentClass(newDocumentClass: KClass<NewTDocument>): MongoCollection<NewTDocument>

Create a new MongoCollection instance with a different default class to cast any documents returned from the database into..

Return

a new MongoCollection instance with the different default class

Parameters

newDocumentClass

the default class to cast any documents returned from the database into.

the type that the new collection will encode documents from and decode documents to