mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
fixed
This commit is contained in:
parent
7d2e5c4b4a
commit
b5ecd35e80
@ -1,9 +1,10 @@
|
||||
package me.totalfreedom.plex.storage;
|
||||
|
||||
import com.mongodb.MongoClient;
|
||||
import com.mongodb.MongoClientURI;
|
||||
import com.mongodb.client.MongoClient;
|
||||
import com.mongodb.client.MongoClients;
|
||||
import dev.morphia.Datastore;
|
||||
import dev.morphia.Morphia;
|
||||
import dev.morphia.mapping.MapperOptions;
|
||||
import me.totalfreedom.plex.Plex;
|
||||
import me.totalfreedom.plex.player.PlexPlayer;
|
||||
|
||||
@ -26,10 +27,9 @@ public class MongoConnection
|
||||
String database = plugin.config.getString("data.central.db");
|
||||
|
||||
String connectionString = "mongodb://" + username + ":" + password + "@" + host + ":" + port + "/?authSource=" + database;
|
||||
MongoClient client = new MongoClient(new MongoClientURI(connectionString));
|
||||
Morphia morphia = new Morphia();
|
||||
Datastore datastore = morphia.createDatastore(client, database);
|
||||
datastore.getMapper().addMappedClass(PlexPlayer.class);
|
||||
MongoClient client = MongoClients.create(connectionString);
|
||||
Datastore datastore = Morphia.createDatastore(client, database, MapperOptions.DEFAULT);
|
||||
datastore.getMapper().map(PlexPlayer.class);
|
||||
datastore.ensureIndexes();
|
||||
plugin.setStorageType(StorageType.MONGO);
|
||||
return datastore;
|
||||
|
Loading…
Reference in New Issue
Block a user