MongoDB Loader
Modern MongoDB database connectivity for Minecraft servers.
MongoDB Loader is a library plugin that gives other plugins a working MongoDB
connection. It bundles the current mongodb-driver-sync library, so plugins that
need a database do not each have to ship their own driver.
It adds no gameplay features on its own. It is a dependency: install it, and the plugins that need MongoDB will use it.
Key features
- Universal platform support. Works across Bukkit, Spigot, Paper, BungeeCord, Velocity and Sponge.
- Latest MongoDB driver, kept current.
- Automatic platform detection. A single jar works everywhere.
- Zero configuration. Drop it in and start the server.
- Developer friendly, with a small integration surface.
- Performance optimised, minimal overhead and efficient connections.
Installing
Download mongodb-loader-<version>.jar and put it in:
| Platform | Folder |
|---|---|
| Bukkit, Spigot, Paper | plugins/ |
| BungeeCord | plugins/ |
| Velocity | plugins/ |
| Sponge | mods/ |
Start the server and it detects the platform by itself. Then install whatever plugins depend on it.
For plugin developers
Declare it as a dependency:
Bukkit, Spigot, Paper (plugin.yml)
depend: [MongoDBLoader]
# or, if optional
softdepend: [MongoDBLoader]
BungeeCord (bungee.yml)
depends: [MongoDBLoader]
# or, if optional
softDepends: [MongoDBLoader]
Velocity (velocity-plugin.json)
{
"dependencies": [
{ "id": "mongodb-loader", "optional": false }
]
}
Sponge
@Plugin("your-plugin-id")
@Dependency("mongodb-loader")
public class YourPlugin {
// ...
}
Then use the driver as normal:
import com.mongodb.client.MongoClient;
import com.mongodb.client.MongoClients;
import com.mongodb.client.MongoDatabase;
import org.bukkit.plugin.java.JavaPlugin;
public class YourPlugin extends JavaPlugin {
private MongoClient mongoClient;
private MongoDatabase database;
@Override
public void onEnable() {
mongoClient = MongoClients.create("mongodb://localhost:27017");
database = mongoClient.getDatabase("minecraft_server");
getLogger().info("Connected to MongoDB!");
}
}
Compatibility
Minecraft 1.13 and newer. Server side only.
Source and issues: https://github.com/AshleyThew/mongodb-loader
Information
Pinned Versions
- R1.13–26.21.13–1.211.0–3.5
Pages
Members
1Owner