Run the following command to create a managed MongoDB database:
simplifyd create datastore
Specify the following attributes:
- Name for the database
- Project database should be setup under
- Type. In this case that should be
mongodbsince we are creating a MongoDB database
- Runner. This should be any of the valid Simplifyd runner types [nano, micro, milli, kilo, mega, giga, tera]
- Disk size.
Once this is done, Simplifyd begins to create the database. Once ready, the folloeing environment variables are injected into the project which is made available to all apps within the project:
MONGODB_<DB_NAME>_URL. This environment variable holds the connection URL to the database.
MONGODB_<DB_NAME>_PORT. This environment variable holds the DB Port.
DB_NAME refers to the name given to the MongoDB database during setup.
Together these environment variables are used to create the connection string needed to connect to the database.
It's important to note that previously running apps would need to be stopped or updated so that they get configured with the new environment variables.
It's also important to note that at the moment external connections over the internet cannot be made to the databases. Connections can only be made from the apps within the same project.