File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change 1
1
import com.mongodb.kotlin.client.MongoClient
2
- import org.bson.json.JsonWriterSettings
3
- import com.mongodb.event.*
4
2
import com.mongodb.MongoClientSettings
5
3
import com.mongodb.ConnectionString
6
4
import com.mongodb.management.JMXConnectionPoolListener
7
5
8
-
9
6
fun main () {
10
7
val uri = " <connection string uri>"
11
8
@@ -15,8 +12,11 @@ fun main() {
15
12
// Include the listener in your client settings
16
13
val settings = MongoClientSettings .builder()
17
14
.applyConnectionString(ConnectionString (uri))
18
- .addCommandListener(connectionPoolListener)
15
+ .applyToConnectionPoolSettings {
16
+ it.addConnectionPoolListener(connectionPoolListener)
17
+ }
19
18
.build()
19
+ val mongoClient: MongoClient = MongoClient .create(settings)
20
20
21
21
// Pause execution
22
22
try {
You can’t perform that action at this time.
0 commit comments