๐Ÿƒ MongoDB Setup

Tyche uses MongoDB instead of traditional SQL to ensure that gambling data, collection bins, and player stats are saved instantly without ever lagging your server.

Why MongoDB?

Unlike standard files, MongoDB allows Tyche to handle massive amounts of data across multiple servers (perfect for networks) and ensures that if your server crashes mid-flip, the data is still safe in the cloud.


1. Getting a Free Database (MongoDB Atlas)

If you don't have your own VPS or dedicated MongoDB instance, we recommend MongoDB Atlas. It is free, fast, and reliable.

  1. Go to MongoDB Atlasarrow-up-right and create a free account.

  2. Create a Cluster: Choose the "Shared" (Free) tier.

  3. Security (Crucial):

    • Network Access: Add 0.0.0.0/0 to the IP Access List to allow your Minecraft server to connect (or add your server's specific IP for better security).

    • Database Access: Create a database user with a username and password. Remember these!


2. Obtaining your Connection URI

To connect Tyche to your database, you need a "Connection String."

  1. Click the "Connect" button on your Database Cluster.

  2. Select "Connect your application".

  3. Choose Java as the driver.

  4. Copy the string that looks like this: mongodb+srv://<username>:<password>@cluster.example.mongodb.net/?retryWrites=true&w=majority


3. Applying to Tyche

Open your config.yml and find the mongodb section. Paste your URI and replace <password> with your actual password.

YAML

{% hint style="warning" %} Security Tip: Never share your Connection URI with anyone. It contains your database password and gives full access to your plugin data. {% endhint %}


4. Troubleshooting Connection Issues

If you see [Tyche] Failed to connect to MongoDB in your console:

  • Whitelist the IP: Ensure you added your server's IP to the MongoDB Atlas "Network Access" tab.

  • Special Characters: If your password contains symbols like @ or :, you must "URL Encode" them (e.g., @ becomes %40) or change your password to use only letters and numbers.

  • Driver Version: Tyche uses the 3.12.14 driver, which is compatible with all modern Atlas clusters.

Last updated