withDocumentClass

fun <R : Any> withDocumentClass(resultClass: Class<R>): MongoCollection<R>

Create a new collection 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

R

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

resultClass

the target document type for the collection.


Create a new collection 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

R

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