getCollection

abstract fun getCollection(name: String): MongoCollection<Document>

Gets a collection.

Return

the collection

See also

com.mongodb.MongoNamespace

Parameters

name

the name of the collection to return

Throws

if collectionName is invalid


abstract fun <TDocument : Any> getCollection(name: String, documentClass: KClass<TDocument>): MongoCollection<TDocument>

Gets a collection, with a specific default document class.

Return

the collection

Parameters

name

the name of the collection to return

documentClass

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

the type of the class to use instead of `Document`.