diff --git a/driver-coroutines-kmongo/src/jvmMain/kotlin/KMongoExt.kt b/driver-coroutines-kmongo/src/jvmMain/kotlin/KMongoExt.kt --- a/driver-coroutines-kmongo/src/jvmMain/kotlin/KMongoExt.kt +++ b/driver-coroutines-kmongo/src/jvmMain/kotlin/KMongoExt.kt @@ -17,8 +17,8 @@ package opensavvy.ktmongo.coroutines.kmongo import com.mongodb.reactivestreams.client.MongoCollection -import opensavvy.ktmongo.coroutines.JvmMongoCollection -import opensavvy.ktmongo.coroutines.asKtMongoLegacy +import opensavvy.ktmongo.coroutines.CoroutineMongoCollection +import opensavvy.ktmongo.coroutines.asKtMongo import opensavvy.ktmongo.dsl.path.PropertyNameStrategy import opensavvy.ktmongo.utils.kmongo.KMongoNameStrategy @@ -27,5 +27,5 @@ */ inline fun MongoCollection.asKtMongo( nameStrategy: PropertyNameStrategy = KMongoNameStrategy(), -): JvmMongoCollection = - com.mongodb.kotlin.client.coroutine.MongoCollection(this).asKtMongoLegacy(nameStrategy) +): CoroutineMongoCollection = + com.mongodb.kotlin.client.coroutine.MongoCollection(this).asKtMongo(propertyNameStrategy = nameStrategy) diff --git a/test-legacy/src/commonMain/kotlin/TestDatabase.kt b/test-legacy/src/commonMain/kotlin/TestDatabase.kt --- a/test-legacy/src/commonMain/kotlin/TestDatabase.kt +++ b/test-legacy/src/commonMain/kotlin/TestDatabase.kt @@ -17,17 +17,17 @@ package opensavvy.ktmongo.test import kotlinx.coroutines.ensureActive -import opensavvy.ktmongo.coroutines.MongoCollection +import opensavvy.ktmongo.coroutines.CoroutineMongoCollection import opensavvy.prepared.suite.PreparedProvider import opensavvy.prepared.suite.cleanUp import opensavvy.prepared.suite.prepared import opensavvy.prepared.suite.random.randomInt import kotlin.coroutines.coroutineContext -expect inline fun testCollectionExact(name: String): PreparedProvider> +expect inline fun testCollectionExact(name: String): PreparedProvider> val collectionPostfix by randomInt(0, Int.MAX_VALUE) -inline fun testCollection(name: String): PreparedProvider> = prepared { +inline fun testCollection(name: String): PreparedProvider> = prepared { val name = "$name-${collectionPostfix()}" val realCollection by testCollectionExact(name) diff --git a/test-legacy/src/commonTest/kotlin/AggregationTests.kt b/test-legacy/src/commonTest/kotlin/AggregationTests.kt --- a/test-legacy/src/commonTest/kotlin/AggregationTests.kt +++ b/test-legacy/src/commonTest/kotlin/AggregationTests.kt @@ -19,9 +19,8 @@ package opensavvy.ktmongo.sync import kotlinx.serialization.Serializable -import opensavvy.ktmongo.coroutines.filter -import opensavvy.ktmongo.coroutines.first -import opensavvy.ktmongo.coroutines.toList +import opensavvy.ktmongo.api.first +import opensavvy.ktmongo.api.toList import opensavvy.ktmongo.dsl.DangerousMongoApi import opensavvy.ktmongo.dsl.LowLevelApi import opensavvy.ktmongo.test.testCollection diff --git a/test-legacy/src/commonTest/kotlin/FilteredCollectionTest.kt b/test-legacy/src/commonTest/kotlin/FilteredCollectionTest.kt --- a/test-legacy/src/commonTest/kotlin/FilteredCollectionTest.kt +++ b/test-legacy/src/commonTest/kotlin/FilteredCollectionTest.kt @@ -17,7 +17,6 @@ package opensavvy.ktmongo.sync import kotlinx.serialization.Serializable -import opensavvy.ktmongo.coroutines.filter import opensavvy.ktmongo.test.testCollection import opensavvy.prepared.runner.testballoon.preparedSuite import opensavvy.prepared.suite.config.CoroutineTimeout diff --git a/test-legacy/src/jvmMain/kotlin/TestDatabase.jvm.kt b/test-legacy/src/jvmMain/kotlin/TestDatabase.jvm.kt --- a/test-legacy/src/jvmMain/kotlin/TestDatabase.jvm.kt +++ b/test-legacy/src/jvmMain/kotlin/TestDatabase.jvm.kt @@ -19,8 +19,8 @@ import com.mongodb.MongoTimeoutException import com.mongodb.kotlin.client.coroutine.MongoClient import kotlinx.coroutines.CoroutineName -import opensavvy.ktmongo.coroutines.MongoCollection -import opensavvy.ktmongo.coroutines.asKtMongoLegacy +import opensavvy.ktmongo.coroutines.CoroutineMongoCollection +import opensavvy.ktmongo.coroutines.asKtMongo import opensavvy.prepared.suite.PreparedProvider import opensavvy.prepared.suite.prepared import opensavvy.prepared.suite.shared @@ -38,7 +38,7 @@ client.getDatabase("ktmongo-sync-tests") } -actual inline fun testCollectionExact(name: String): PreparedProvider> = prepared(CoroutineName("mongodb-create-collection-$name")) { +actual inline fun testCollectionExact(name: String): PreparedProvider> = prepared(CoroutineName("mongodb-create-collection-$name")) { val collection = database().getCollection(name) - collection.asKtMongoLegacy() + collection.asKtMongo() } diff --git a/test-legacy/src/commonTest/kotlin/studies/AggregationLookup.kt b/test-legacy/src/commonTest/kotlin/studies/AggregationLookup.kt --- a/test-legacy/src/commonTest/kotlin/studies/AggregationLookup.kt +++ b/test-legacy/src/commonTest/kotlin/studies/AggregationLookup.kt @@ -19,8 +19,8 @@ package opensavvy.ktmongo.sync.studies import kotlinx.serialization.Serializable +import opensavvy.ktmongo.api.toList import opensavvy.ktmongo.bson.types.ObjectId -import opensavvy.ktmongo.coroutines.toList import opensavvy.ktmongo.test.testCollection import opensavvy.prepared.runner.testballoon.preparedSuite import kotlin.time.Instant diff --git a/test-legacy/src/commonTest/kotlin/studies/AggregationProjectUnionWith.kt b/test-legacy/src/commonTest/kotlin/studies/AggregationProjectUnionWith.kt --- a/test-legacy/src/commonTest/kotlin/studies/AggregationProjectUnionWith.kt +++ b/test-legacy/src/commonTest/kotlin/studies/AggregationProjectUnionWith.kt @@ -17,8 +17,8 @@ package opensavvy.ktmongo.sync.studies import kotlinx.serialization.Serializable -import opensavvy.ktmongo.coroutines.MongoAggregationPipeline -import opensavvy.ktmongo.coroutines.toList +import opensavvy.ktmongo.api.toList +import opensavvy.ktmongo.coroutines.CoroutineMongoAggregationPipeline import opensavvy.ktmongo.dsl.aggregation.stages.ProjectStageOperators import opensavvy.ktmongo.dsl.query.FilterQuery import opensavvy.ktmongo.test.testCollection @@ -201,7 +201,7 @@ * const commonSort = {$sort: {'customer.name': -1}}; * ``` */ - fun MongoAggregationPipeline.commonSort() = sort { + fun CoroutineMongoAggregationPipeline.commonSort() = sort { descending(Invoice::customer / Customer::name) } @@ -212,7 +212,7 @@ * const commonLimit = {$limit: 20}; * ``` */ - fun MongoAggregationPipeline.commonLimit() = limit(20) + fun CoroutineMongoAggregationPipeline.commonLimit() = limit(20) test("Case study with \$unionWith") { drafts().insertOne(