Skip to content

Commit

Permalink
use kotlin mongo driver, many many versions more up to date
Browse files Browse the repository at this point in the history
  • Loading branch information
Dawsson committed Jul 22, 2024
1 parent c1b67f5 commit ffeca68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ dependencies {
exclude(module = "opus-java")
}
implementation("gg.flyte:neptune:2.4")
implementation("org.mongodb:mongodb-driver-sync:4.9.0")
implementation("org.mongodb:mongodb-driver-kotlin-sync:5.1.1")
implementation("io.github.cdimascio:dotenv-kotlin:6.4.1")
implementation("com.github.mlgpenguin:MathEvaluator:2.1.1")
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/kotlin/com/learnspigot/bot/util/Mongo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import org.bson.Document

object Mongo {

private val client = MongoClients.create(Environment.get("MONGO_URI"))
private val client = MongoClients.create(Environment.get("MONGO_URI")).also {
println("Connected to MongoDB with URI: ${Environment.get("MONGO_URI")}")
}
private val database = client.getDatabase(Environment.get("MONGO_DATABASE"))

val userCollection: MongoCollection<Document> = database.getCollection("users")
Expand Down

0 comments on commit ffeca68

Please sign in to comment.