diff --git a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoDbSession.kt b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoDbSession.kt index 095a6bf..c0cfa73 100644 --- a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoDbSession.kt +++ b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoDbSession.kt @@ -25,7 +25,7 @@ class MongoDbSession( } } - fun MongoTable<*>.internalRun(block: (MongoCollection) -> T): T = + override fun MongoTable<*>.internalRun(block: (MongoCollection) -> T): T = block( withCollection(this) ) diff --git a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoOperation.kt b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoOperation.kt index 06c7adf..4805662 100644 --- a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoOperation.kt +++ b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoOperation.kt @@ -7,8 +7,6 @@ typealias MongoOutcome = Outcome - - fun mongoCalculation(calculation: MongoSession.(U) -> T): (U) -> MongoOperation = //unit { input: U -> MongoOperation { session -> calculation(session, input) } } diff --git a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoSession.kt b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoSession.kt index 6608952..975ab44 100644 --- a/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoSession.kt +++ b/kondor-mongo/src/main/kotlin/com/ubertob/kondor/mongo/core/MongoSession.kt @@ -57,6 +57,10 @@ interface MongoSession { fun MongoTable.drop() fun MongoTable.listIndexes(): Sequence + + //Useful for getting access to all drivers methods + fun MongoTable<*>.internalRun(block: (MongoCollection) -> T): T + companion object { val RETURN_UPDATED = FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER) val RETURN_BEFORE = FindOneAndUpdateOptions().returnDocument(ReturnDocument.BEFORE)