You can host MongoDB yourself, but we recommend using MongoDB Atlas. They offer a free tier for light usage and make it easy to extend if needed.
-
Follow the MongoDB Atlas Official Tutorial to create your account, first Project and first Cluster (M0 Cluster for free tier).
-
Follow the connection guild to set security permission, then select Connect to your application > Drivers in step 1.
- Copy the connection string provided by MongoDB Atlas below in step 2. It should start with
mongodb+srv://...
.
- Create two Databases under the Cluster:
bot
: to store data about servers being served by the bot- Create two Collections named
guild
anduser
under this Database.
- Create two Collections named
abandon
: to store data about servers that are no longer being served, for example, when the bot is removed from a server, its data would be archived into this Database.- Create one Collection named
guild_left
under this Database.
- Create one Collection named
- The names of the Database and Collections can be anything you want, but remember to replace their names into
.env
file later.
- Based on your OS, following the MongoDB Official Tutorial to download the MongoDB Community Edition. For example, if you run on macOS:
brew tap mongodb/brew
brew update
brew install mongodb-community@7.0
- Run MongoDB in local server.
# To run MongoDB (i.e. the mongod process) as a macOS service, run:
brew services start mongodb-community@7.0
# To verify that MongoDB is running
# It should show 'mongodb-community started'
brew services list
# To stop a mongod running as a macOS service, use the following command as needed:
brew services stop mongodb-community@7.0
-
(Optional, but Recommended if you prefer to use GUI tool) Follow Tutorial, download and install MongoDB Compass GUI.
-
Make sure that MongoDB is running, open MongoDB Compass GUI and make a new connection to localhost.
-
Copy localhost URI as connection string (it should start with
mongodb://localhost...
) to.env
file. -
Create two Databases:
bot
: to store data about servers being served by the bot- Create two Collections named
guild
anduser
under this Database.
- Create two Collections named
abandon
: to store data about servers that are no longer being served, for example, when the bot is removed from a server, its data would be archived into this Database.- Create one Collection named
guild_left
under this Database.
- Create one Collection named
- The names of the Database and Collections can be anything you want, but remember to replace their names into
.env
file later.