Skip to content

Commit 904348b

Browse files
authored
DOCSP-46446: v5.3 release (#188)
* DOCSP-46446: v5.3 release * fix examples for bulk * small fix
1 parent 6d35b20 commit 904348b

24 files changed

+289
-99
lines changed

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 v5.2 master
3+
define: versions v4.10 v4.11 v5.0 v5.1 v5.2 v5.3 master
44

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

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.2.0
2+
kotlin_mongodb_version=5.3.0

examples/src/test/kotlin/AggregatesBuilderTest.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import config.getConfig
3434
import kotlinx.coroutines.flow.firstOrNull
3535
import kotlinx.coroutines.flow.toList
3636
import kotlinx.coroutines.runBlocking
37+
import org.bson.BinaryVector
3738
import org.bson.Document
3839
import org.bson.codecs.pojo.annotations.BsonId
3940
import org.bson.types.ObjectId
@@ -970,7 +971,8 @@ class AggregatesBuilderTest {
970971
assertEquals(1, results.first().get("count", Document::class.java).get("lowerBound", java.lang.Long::class.java)?.toInt())
971972
}
972973

973-
/* NOTE: Test is not run by default. Vector search requires the creation of a vector search index on the collection before running.
974+
/* NOTE: Test is not run by default. Vector search requires the creation of
975+
a vector search index on the collection before running.
974976
*/
975977
@Ignore
976978
fun vectorSearchTest() = runBlocking {
@@ -979,7 +981,7 @@ class AggregatesBuilderTest {
979981
// :snippet-start: vector-search
980982
Aggregates.vectorSearch(
981983
SearchPath.fieldPath(MovieAlt::plotEmbedding.name),
982-
listOf(-0.0072121937, -0.030757688, -0.012945653),
984+
BinaryVector.floatVector(floatArrayOf(0.0001f, 1.12345f, 2.23456f, 3.34567f, 4.45678f)),
983985
"mflix_movies_embedding_index",
984986
1.toLong(),
985987
exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))

examples/src/test/kotlin/BulkTest.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import com.mongodb.client.model.DeleteOneModel
66
import com.mongodb.client.model.Filters
77
import com.mongodb.client.model.InsertOneModel
88
import com.mongodb.client.model.ReplaceOneModel
9+
import com.mongodb.client.model.ReplaceOptions
10+
import com.mongodb.client.model.Sorts
911
import com.mongodb.client.model.UpdateOneModel
12+
import com.mongodb.client.model.UpdateOptions
1013
import com.mongodb.client.model.Updates
1114
import com.mongodb.kotlin.client.coroutine.MongoClient
1215
import config.getConfig
@@ -95,6 +98,11 @@ internal class BulkTest {
9598
val insert = Person(1, "Celine Stork", location = "San Diego, CA")
9699
val doc = ReplaceOneModel(filter, insert)
97100
// :snippet-end:
101+
102+
// :snippet-start: replace-model-options
103+
val opts = ReplaceOptions().sort(Sorts.ascending("_id"))
104+
// :snippet-end:
105+
98106
// Junit test for the above code
99107
val insertTest = collection.bulkWrite(listOf(doc))
100108
assertTrue(insertTest.wasAcknowledged())
@@ -107,6 +115,11 @@ internal class BulkTest {
107115
val update = Updates.inc(Person::age.name, 1)
108116
val doc = UpdateOneModel<Person>(filter, update)
109117
// :snippet-end:
118+
119+
// :snippet-start: update-model-options
120+
val opts = UpdateOptions().sort(Sorts.ascending("_id"))
121+
// :snippet-end:
122+
110123
// Junit test for the above code
111124
val updateTest = collection.bulkWrite(listOf(doc))
112125
assertTrue(updateTest.wasAcknowledged())

examples/src/test/kotlin/ChangeTest.kt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11

22
import com.mongodb.client.model.Filters
3+
import com.mongodb.client.model.ReplaceOptions
4+
import com.mongodb.client.model.Sorts
5+
import com.mongodb.client.model.UpdateOptions
36
import com.mongodb.client.model.Updates
47
import com.mongodb.kotlin.client.coroutine.MongoClient
58
import config.getConfig
@@ -63,6 +66,11 @@ internal class ChangeTest {
6366
println("Matched document count: $result.matchedCount")
6467
println("Modified document count: $result.modifiedCount")
6568
// :snippet-end:
69+
70+
// :snippet-start: update-one-options
71+
val opts = UpdateOptions().sort(Sorts.ascending(PaintOrder::color.name))
72+
// :snippet-end:
73+
6674
// Junit test for the above code
6775
assertEquals(1, result.modifiedCount)
6876
}
@@ -90,6 +98,11 @@ internal class ChangeTest {
9098
println("Matched document count: $result.matchedCount")
9199
println("Modified document count: $result.modifiedCount")
92100
// :snippet-end:
101+
102+
// :snippet-start: replace-one-options
103+
val opts = ReplaceOptions().sort(Sorts.ascending(PaintOrder::color.name))
104+
// :snippet-end:
105+
93106
// Junit test for the above code
94107
assertEquals(1, result.modifiedCount)
95108
}

snooty.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,16 @@ toc_landing_pages = [
1212
"/fundamentals/builders",
1313
"/usage-examples",
1414
"/api-documentation",
15+
"/fundamentals/builders/aggregates",
1516
]
1617
sharedinclude_root = "https://github.com/10gen/docs-shared/main/"
1718

1819
[constants]
1920
driver = "kotlin"
2021
driver-short = "Kotlin driver"
2122
driver-long = "MongoDB Kotlin Driver"
22-
version = "5.2"
23-
full-version = "{+version+}.1"
23+
version = "5.3"
24+
full-version = "{+version+}.0"
2425
language = "Kotlin"
2526
mdb-server = "MongoDB server"
2627
kotlin-docs = "https://kotlinlang.org"
@@ -34,5 +35,5 @@ snappyVersion = "org.xerial.snappy:snappy-java:1.1.8.4"
3435
zstdVersion = "com.github.luben:zstd-jni:1.5.5-2"
3536
logbackVersion = "1.2.11"
3637
log4j2Version = "2.17.1"
37-
serializationVersion = "1.5.1"
38+
serializationVersion = "1.6.0"
3839
kotlinx-dt-version = "0.6.1"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Aggregates.vectorSearch(
22
SearchPath.fieldPath(MovieAlt::plotEmbedding.name),
3-
listOf(-0.0072121937, -0.030757688, -0.012945653),
3+
BinaryVector.floatVector(floatArrayOf(0.0001f, 1.12345f, 2.23456f, 3.34567f, 4.45678f)),
44
"mflix_movies_embedding_index",
55
1.toLong(),
66
exactVectorSearchOptions().filter(Filters.gte(MovieAlt::year.name, 2016))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
val opts = ReplaceOptions().sort(Sorts.ascending("_id"))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
val opts = UpdateOptions().sort(Sorts.ascending("_id"))
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
val opts = ReplaceOptions().sort(Sorts.ascending(PaintOrder::color.name))

0 commit comments

Comments
 (0)