Skip to content

Commit ec6e87e

Browse files
authored
Merge branch 'master' into docsp-43565-vector-index-correction
2 parents b391ee5 + 05b10e4 commit ec6e87e

21 files changed

+217
-95
lines changed

.github/workflows/check-autobuilder.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

config/redirects

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
define: prefix docs/drivers/kotlin/coroutine
22
define: base https://www.mongodb.com/${prefix}
3-
define: versions v4.10 v4.11 v5.0 v5.1 master
3+
define: versions v4.10 v4.11 v5.0 v5.1 v5.2 master
44

55
raw: ${prefix}/ -> ${base}/current/
66

examples/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ dependencies {
2828
implementation("com.github.luben:zstd-jni:1.5.5-4")
2929
implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.5.1")
3030
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.5.0")
31-
implementation("org.mongodb:bson-kotlinx:5.1.2")
31+
implementation("org.mongodb:bson-kotlinx:$kotlin_mongodb_version")
3232
implementation("org.jetbrains.kotlinx:kotlinx-datetime:0.4.0")
3333
}
3434

examples/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
kotlin.code.style=official
2-
kotlin_mongodb_version=5.1.2
2+
kotlin_mongodb_version=5.2.0

examples/src/test/kotlin/AggregatesBuilderTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import com.mongodb.client.model.geojson.Position
2828
import com.mongodb.client.model.search.SearchOperator
2929
import com.mongodb.client.model.search.SearchOptions
3030
import com.mongodb.client.model.search.SearchPath
31-
import com.mongodb.client.model.search.VectorSearchOptions.vectorSearchOptions
31+
import com.mongodb.client.model.search.VectorSearchOptions.exactVectorSearchOptions
3232
import com.mongodb.kotlin.client.coroutine.MongoClient
3333
import config.getConfig
3434
import kotlinx.coroutines.flow.firstOrNull
@@ -981,13 +981,13 @@ class AggregatesBuilderTest {
981981
SearchPath.fieldPath(MovieAlt::plotEmbedding.name),
982982
listOf(-0.0072121937, -0.030757688, -0.012945653),
983983
"mflix_movies_embedding_index",
984-
2.toLong(),
985984
1.toLong(),
986-
vectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))
985+
exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))
987986
)
988987
// :snippet-end:
989988
)
990989
)
990+
991991
val results = resultsFlow.toList()
992992
assertEquals(1, resultsFlow.toList().size)
993993
assertEquals(1, results.first().get("count", Document::class.java).get("lowerBound", java.lang.Long::class.java)?.toInt())

examples/src/test/kotlin/KotlinXSerializationTest.kt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,6 @@ internal class KotlinXSerializationTest {
204204
val department: String,
205205
) : Person
206206
// :snippet-end:
207-
208207
@Test
209208
fun polymorphicSerializationTest() = runBlocking {
210209

@@ -242,5 +241,34 @@ internal class KotlinXSerializationTest {
242241
collection.drop()
243242
}
244243

244+
// :snippet-start: datetime-data-class
245+
@Serializable
246+
data class Appointment(
247+
val name: String,
248+
@Contextual val date: LocalDate,
249+
val time: LocalTime,
250+
)
251+
// :snippet-end:
252+
253+
@Test
254+
fun dateTimeSerializationTest() = runBlocking {
255+
256+
// :snippet-start: datetime-insertone
257+
val collection = database.getCollection<Appointment>("appointments")
258+
259+
val apptDoc = Appointment(
260+
"Daria Smith",
261+
LocalDate(2024, 10, 15),
262+
LocalTime(hour = 11, minute = 30)
263+
)
264+
265+
collection.insertOne(apptDoc)
266+
// :snippet-end:
267+
268+
assertEquals(apptDoc.name, "Daria Smith")
269+
270+
collection.drop()
271+
}
272+
245273
}
246274

examples/src/test/kotlin/SearchIndexesTest.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11

22
import com.mongodb.client.model.SearchIndexModel
3+
import com.mongodb.client.model.SearchIndexType
34
import com.mongodb.kotlin.client.coroutine.MongoClient
45
import config.getConfig
56
import kotlinx.coroutines.flow.toList

snooty.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,20 @@ sharedinclude_root = "https://raw.githubusercontent.com/10gen/docs-shared/main/"
1919
driver = "kotlin"
2020
driver-short = "Kotlin driver"
2121
driver-long = "MongoDB Kotlin Driver"
22-
version = "5.1"
23-
full-version = "{+version+}.2"
22+
version = "5.2"
23+
full-version = "{+version+}.0"
2424
language = "Kotlin"
2525
mdb-server = "MongoDB server"
2626
kotlin-docs = "https://kotlinlang.org"
2727

2828
package-name-org = "mongodb-org"
2929
api = "https://mongodb.github.io/mongo-java-driver/{+version+}"
3030
stable-api = "Stable API"
31-
mongocrypt-version = "1.7.3"
31+
mongocrypt-version = "{+full-version+}"
3232
nettyVersion = "io.netty:netty-all:4.1.79.Final"
3333
snappyVersion = "org.xerial.snappy:snappy-java:1.1.8.4"
3434
zstdVersion = "com.github.luben:zstd-jni:1.5.5-2"
3535
logbackVersion = "1.2.11"
3636
log4j2Version = "2.17.1"
3737
serializationVersion = "1.5.1"
38+
kotlinx-dt-version = "0.6.1"

source/examples/generated/AggregatesBuilderTest.snippet.vector-search.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ Aggregates.vectorSearch(
22
SearchPath.fieldPath(MovieAlt::plotEmbedding.name),
33
listOf(-0.0072121937, -0.030757688, -0.012945653),
44
"mflix_movies_embedding_index",
5-
2.toLong(),
65
1.toLong(),
7-
vectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))
6+
exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))
87
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@Serializable
2+
data class Appointment(
3+
val name: String,
4+
@Contextual val date: LocalDate,
5+
val time: LocalTime,
6+
)

0 commit comments

Comments
 (0)