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