diff --git a/Database.md b/Database-API.md similarity index 82% rename from Database.md rename to Database-API.md index 2783baa..61bbe4f 100644 --- a/Database.md +++ b/Database-API.md @@ -1,8 +1,15 @@ # Introduction -BentoBox provides a database for you so you do not have to make one yourself. The BentoBox database can be chosen to store data in flat file, MySQL or Mongo. You do not have to worry or care about which one is used. BentoBox's database stores Java Objects by serializing them. For MySQL and Mongo, the java object will be converted to JSON and stored as JSON. For flat file, the object is converted and stored as YAML. +BentoBox provides a database API for developers so you do not have to make one yourself. The BentoBox database can be chosen to store data in a flat-file, MySQL, Mongo, SQLite, PostGreSQL, MariaDB, etc. You do not have to worry or care about which one is used. Note that YAML is no longer supported as a database, however it is used for configuration files via the Config API. -# How To +## Philosophy + +We have taken a "NoSQL" approach to the BentoBox database. i.e., we store serialized Java objects as JSON "blobs" in the database. Each table in the database is assigned to store a specific Java object, e.g., islands, players, challenges, etc. and each entry in the table is one object. The tables have two columns - a unique ID and the JSON object. Databases such as PostgreSQL can store these JSON objects in a binary form, which makes them handle this approach efficiently. + +### How do I access the data from outside BentoBox? +Most of the supported databases, e.g., MySQL, PostgreSQL, etc. support queries on the JSON data directly. The only ones that do not are flat-file based, i.e., JSON and SQLite. Therefore, you should look up the documentation on how to make JSON queries for your database. + +## How To To store a class in the BentoBox database do the following: