0 Replies - 835 Views - Last Post: 21 August 2017 - 06:38 AM Rate Topic: -----

#1 unenergizer   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 14-November 13

Efficient Bukkit multi-plugin Mongo database design

Posted 21 August 2017 - 06:38 AM

NOTE: I know this is not a "Bukkit" or Minecraft related website, but I believe the awesome people here will have more knowledge of database design with Mongo than the kids do on the Minecraft forums. Thank you for your time and your assistance!

I am needing advice on how to solve a Mongo database design issue. As such, I have multiple plugins that need to read/write to Mongo. Each plugin uses a "main" or core plugin to communicate with MongoDB. Each plugin holds data related to that particular plugin. Questions and code references provided below.

Plugin Setup Example:

Core Plugin:

- MongoDB Access.
- Utility Classes.
- Shared classes among all plugins.
- This plugin is used on all servers.

Minigame Plugin:

- Contains a variety of games.
- Each game within the plugin needs to save game specific statistics
  (kills, times played, etc).
- Will continue to be expanded to have more games and more data to save.
- This plugin is *not* used on all servers.

Some future plugin:

- Will need to save data that is currently unknown but will be designed
  in the future.

Some questions regarding the design for this specific setup:

1. Should all data for each current plugin and future plugins and
   features use one specific Mongo database document?
2. Should each plugin have it's own document?
3. As features expand and new data needs to be saved and retrived, how
   do I prevent NullPointerExceptions due to old profiles not
   containing new data (for instance a new minigame release)?

My original thoughts were to pack everything into one single profile document. However not all data in the document would be needed for ever server. So my next idea was to refactor the current setup and separate my database design into multiple documents based on each plugin. However this seems clunky and my lack of experience shows.  I am looking for an intelligent design based around my current circumstances. Multiple plugins with constantly evolving sets of data.

My code for reference:

My current profile read/write code: https://pastebin.com/HExiVi5d
My profile data class: https://pastebin.com/8fX6X6b7

Is This A Good Question/Topic? 0
  • +

Page 1 of 1