Skip to content
This repository was archived by the owner on Dec 1, 2021. It is now read-only.

Commit 1bd21ff

Browse files
committed
Deprecated the initMongoDatabase method.
1 parent 6b23781 commit 1bd21ff

File tree

1 file changed

+2
-18
lines changed
  • src/main/java/net/javadiscord/javabot2

1 file changed

+2
-18
lines changed

src/main/java/net/javadiscord/javabot2/Bot.java

+2-18
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,6 @@ public class Bot {
3232
*/
3333
public static HikariDataSource hikariDataSource;
3434

35-
/**
36-
* A thread-safe MongoDB client that can be used to interact with MongoDB.
37-
* @deprecated Use the relational data source for all future persistence
38-
* needs; it promotes more organized code that's less prone to failures.
39-
*/
40-
@Deprecated
41-
public static MongoClient mongoClient;
42-
43-
/**
44-
* The single Mongo database where all bot data is stored.
45-
* @deprecated Use the relational data source for all future persistence
46-
* needs; it promotes more organized code that's less prone to failures.
47-
*/
48-
@Deprecated
49-
public static MongoDatabase mongoDb;
50-
5135
/**
5236
* The bot's configuration.
5337
*/
@@ -101,11 +85,11 @@ private static void initDataSources() {
10185
throw new IllegalStateException("Missing required Discord bot token! Please edit config/systems.json to add it, then run again.");
10286
}
10387
hikariDataSource = DbHelper.initDataSource(config);
104-
mongoDb = initMongoDatabase();
10588
}
10689

90+
@Deprecated
10791
private static MongoDatabase initMongoDatabase() {
108-
mongoClient = new MongoClient(new MongoClientURI(config.getSystems().getMongoDatabaseUrl()));
92+
var mongoClient = new MongoClient(new MongoClientURI(config.getSystems().getMongoDatabaseUrl()));
10993
var db = mongoClient.getDatabase("javabot");
11094
var warnCollection = db.getCollection("warn");
11195
warnCollection.createIndex(Indexes.ascending("userId"), new IndexOptions().unique(false));

0 commit comments

Comments
 (0)