Skip to content

Commit

Permalink
Litote#369 Add client metadata for KMongo
Browse files Browse the repository at this point in the history
  • Loading branch information
jyemin committed Sep 1, 2022
1 parent 323e4e8 commit 3f404c7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package org.litote.kmongo.reactivestreams

import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.MongoDriverInformation
import com.mongodb.reactivestreams.client.MongoClient
import com.mongodb.reactivestreams.client.MongoClients
import org.bson.codecs.configuration.CodecRegistry
Expand Down Expand Up @@ -44,7 +45,8 @@ object KMongo {
val codecRegistry = ClassMappingType.codecRegistry(settings.codecRegistry)
return MongoClients.create(
MongoClientSettings.builder(settings)
.codecRegistry(codecRegistry).build()
.codecRegistry(codecRegistry).build(),
MongoDriverInformation.builder().driverName("kmongo").driverPlatform(String.format("Kotlin/%s", KotlinVersion.CURRENT)).build()
)
}

Expand Down
4 changes: 3 additions & 1 deletion kmongo-core/src/main/kotlin/org/litote/kmongo/KMongo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package org.litote.kmongo
import com.mongodb.ConnectionString
import com.mongodb.MongoClientSettings
import com.mongodb.MongoClientSettings.getDefaultCodecRegistry
import com.mongodb.MongoDriverInformation
import com.mongodb.client.MongoClient
import com.mongodb.client.MongoClients
import org.bson.UuidRepresentation
Expand Down Expand Up @@ -79,7 +80,8 @@ object KMongo {
settings.codecRegistry, settings.uuidRepresentation
)
)
).build()
).build(),
MongoDriverInformation.builder().driverName("kmongo").driverPlatform(String.format("Kotlin/%s", KotlinVersion.CURRENT)).build()
)

private fun createRegistry(codecRegistry: CodecRegistry, uuidRepresentation: UuidRepresentation): CodecRegistry =
Expand Down

0 comments on commit 3f404c7

Please sign in to comment.