MongoDB (BETA)
The MongoDB module is in BETA and available to new installations. Report problems on GitHub.
The MongoDB page lets you create document databases and users on the server's shared MongoDB instance for your applications (Node.js, Python, PHP with the mongodb extension, and so on).
Enabling
The administrator installs MongoDB once from HiTechAdmin > Services > Packages & Apps > MongoDB (or hitechcloudcli mongodb install) and grants the mongodb feature in a plan. Accounts on that plan then see MongoDB in the sidebar.
Databases
Every database and user name is prefixed with your account name (<account>_), the same rule MySQL uses here, so two accounts can never collide.
- New database - enter a name; optionally create a user with
readWriteon it at the same time. - Delete - the button switches to a Confirm countdown; click it again to drop the database and every user created for it.
Users
- New user - a username, password (at least 8 characters, or use Generate) and the database it gets
readWriteon. - Grant - give an existing user access to another of your databases.
- Revoke - click the
×next to a database in the Access to column. - Password - set a new password.
- Delete - remove the user (with a confirm countdown).
Connecting
Users are created in the admin database, so the connection string needs authSource=admin:
mongodb://<account>_USER:PASSWORD@127.0.0.1:27017/<account>_DATABASE?authSource=admin
MongoDB listens on loopback only; applications running on this server connect to 127.0.0.1:27017. Remote access is deliberately not offered - one instance serves every account.
From the terminal
hitechcloudcli mongodb db list <account>
hitechcloudcli mongodb db create <account> <name>
hitechcloudcli mongodb user create <account> <user> <password> <account>_<db>