getSession

fun getSession(entityClass: Class<*>?): ClientSession

Access the current MongoDB ClientSession from the transaction context.

Return

ClientSession or null if not in the context of a transaction.

Parameters

entityClass

the class of the MongoDB entity in case it is configured to use the non-default client.

See also