collection

abstract override fun <Document : Any> collection(name: String, type: KType): SyncMongoCollection<Document>(source)


Creates a SyncMongoCollection object.

This method is purely a client-side operation, it does nothing in the MongoDB server. In MongoDB, databases and collections are created implicitly on the first insert.

For an example, see SyncMongoClient.