diff --git a/config/redirects b/config/redirects index dd13dff8..60527205 100644 --- a/config/redirects +++ b/config/redirects @@ -1,6 +1,6 @@ define: prefix docs/drivers/kotlin/coroutine define: base https://www.mongodb.com/${prefix} -define: versions v4.10 v4.11 v5.0 v5.1 master +define: versions v4.10 v4.11 v5.0 v5.1 v5.2 master raw: ${prefix}/ -> ${base}/current/ diff --git a/examples/gradle.properties b/examples/gradle.properties index d976cab2..28ecde2d 100644 --- a/examples/gradle.properties +++ b/examples/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -kotlin_mongodb_version=5.1.4 +kotlin_mongodb_version=5.2.0 diff --git a/examples/src/test/kotlin/AggregatesBuilderTest.kt b/examples/src/test/kotlin/AggregatesBuilderTest.kt index 7baabe05..78a1af20 100644 --- a/examples/src/test/kotlin/AggregatesBuilderTest.kt +++ b/examples/src/test/kotlin/AggregatesBuilderTest.kt @@ -28,7 +28,7 @@ import com.mongodb.client.model.geojson.Position import com.mongodb.client.model.search.SearchOperator import com.mongodb.client.model.search.SearchOptions import com.mongodb.client.model.search.SearchPath -import com.mongodb.client.model.search.VectorSearchOptions.vectorSearchOptions +import com.mongodb.client.model.search.VectorSearchOptions.exactVectorSearchOptions import com.mongodb.kotlin.client.coroutine.MongoClient import config.getConfig import kotlinx.coroutines.flow.firstOrNull @@ -981,13 +981,13 @@ class AggregatesBuilderTest { SearchPath.fieldPath(MovieAlt::plotEmbedding.name), listOf(-0.0072121937, -0.030757688, -0.012945653), "mflix_movies_embedding_index", - 2.toLong(), 1.toLong(), - vectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016)) + exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016)) ) // :snippet-end: ) ) + val results = resultsFlow.toList() assertEquals(1, resultsFlow.toList().size) assertEquals(1, results.first().get("count", Document::class.java).get("lowerBound", java.lang.Long::class.java)?.toInt()) diff --git a/examples/src/test/kotlin/SearchIndexesTest.kt b/examples/src/test/kotlin/SearchIndexesTest.kt index 47b8b44f..e3448803 100644 --- a/examples/src/test/kotlin/SearchIndexesTest.kt +++ b/examples/src/test/kotlin/SearchIndexesTest.kt @@ -1,5 +1,6 @@ import com.mongodb.client.model.SearchIndexModel +import com.mongodb.client.model.SearchIndexType import com.mongodb.kotlin.client.coroutine.MongoClient import config.getConfig import kotlinx.coroutines.flow.toList diff --git a/snooty.toml b/snooty.toml index 333c144d..7f37077e 100644 --- a/snooty.toml +++ b/snooty.toml @@ -19,8 +19,8 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/" driver = "kotlin" driver-short = "Kotlin driver" driver-long = "MongoDB Kotlin Driver" -version = "5.1" -full-version = "{+version+}.4" +version = "5.2" +full-version = "{+version+}.0" language = "Kotlin" mdb-server = "MongoDB server" kotlin-docs = "https://kotlinlang.org" diff --git a/source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt b/source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt index 7be37509..ee4648f2 100644 --- a/source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt +++ b/source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt @@ -2,7 +2,6 @@ Aggregates.vectorSearch( SearchPath.fieldPath(MovieAlt::plotEmbedding.name), listOf(-0.0072121937, -0.030757688, -0.012945653), "mflix_movies_embedding_index", - 2.toLong(), 1.toLong(), - vectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016)) + exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016)) ) diff --git a/source/fundamentals/builders/aggregates.txt b/source/fundamentals/builders/aggregates.txt index c0eb34d9..1ee12e0e 100644 --- a/source/fundamentals/builders/aggregates.txt +++ b/source/fundamentals/builders/aggregates.txt @@ -932,13 +932,12 @@ The example in this section uses data modeled with the following Kotlin data cla :language: kotlin This example shows how to build an aggregation pipeline that uses the -``vectorSearch()`` method to perform a vector search with the following +``vectorSearch()`` method to perform an exact vector search with the following specifications: - Searches ``plotEmbedding`` field values by using vector embeddings of a string value - Uses the ``mflix_movies_embedding_index`` vector search index -- Considers up to 2 nearest neighbors - Returns 1 document - Filters for documents in which the ``year`` value is at least ``2016`` @@ -947,4 +946,4 @@ specifications: To learn more about this helper, see the `vectorSearch() API documentation -<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#vectorSearch(com.mongodb.client.model.search.FieldSearchPath,java.lang.Iterable,java.lang.String,long,long)>`__. +<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/Aggregates.html#vectorSearch(com.mongodb.client.model.search.FieldSearchPath,java.lang.Iterable,java.lang.String,long,com.mongodb.client.model.search.VectorSearchOptions)>`__. diff --git a/source/fundamentals/indexes.txt b/source/fundamentals/indexes.txt index 179e44a2..12be41ad 100644 --- a/source/fundamentals/indexes.txt +++ b/source/fundamentals/indexes.txt @@ -270,6 +270,11 @@ The following code example shows how to create an Atlas Search index: .. literalinclude:: /examples/generated/SearchIndexesTest.snippet.single-search-index-create.kt :language: kotlin +To create multiple Search or Vector Search indexes, you must create a +`SearchIndexModel +<{+api+}/apidocs/mongodb-driver-core/com/mongodb/client/model/SearchIndexModel.html>`__ +instance for each index. + The following code example shows how to create Search and Vector Search indexes in one call: diff --git a/source/includes/language-compatibility-table-kotlin.rst b/source/includes/language-compatibility-table-kotlin.rst index ddc537ef..8b56e985 100644 --- a/source/includes/language-compatibility-table-kotlin.rst +++ b/source/includes/language-compatibility-table-kotlin.rst @@ -7,14 +7,5 @@ * - Kotlin Driver Version - Kotlin 1.8 - * - 5.1 - - ✓ - - * - 5.0 - - ✓ - - * - 4.11 - - ✓ - - * - 4.10 + * - 4.10 to 5.2 - ✓ diff --git a/source/includes/mongodb-compatibility-table-kotlin.rst b/source/includes/mongodb-compatibility-table-kotlin.rst index f753bcf3..0d78a22e 100644 --- a/source/includes/mongodb-compatibility-table-kotlin.rst +++ b/source/includes/mongodb-compatibility-table-kotlin.rst @@ -12,10 +12,6 @@ - MongoDB 4.2 - MongoDB 4.0 - MongoDB 3.6 - - MongoDB 3.4 - - MongoDB 3.2 - - MongoDB 3.0 - - MongoDB 2.6 * - 5.2 - ✓ @@ -26,12 +22,8 @@ - ✓ - ✓ - ✓ - - - - - - - - - * - 5.1 + * - 4.10 to 5.1 - ⊛ - ✓ - ✓ @@ -40,50 +32,3 @@ - ✓ - ✓ - ✓ - - - - - - - - - - * - 5.0 - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - - * - 4.11 - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - - * - 4.10 - - ⊛ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - ✓ - - - - - - - - - diff --git a/source/whats-new.txt b/source/whats-new.txt index 714607e5..9bb35a6c 100644 --- a/source/whats-new.txt +++ b/source/whats-new.txt @@ -35,6 +35,10 @@ improvements, and fixes: :ref:`kotlin-search-indexes` in the Indexes guide + .. replacement:: vector-search-link + + :ref:`kotlin-atlas-vector-search` in the Aggregates Builders guide + - Adds support for serializers from the ``kotlinx-datetime`` library that let you map {+language+} date and time types to BSON as the expected types instead of as strings. To learn more, see the