Implementation Instructions

MongoDB

The MongoDB database can be accessed via the browser interface at Atlas, by using the Compass application, maintained by using the Database Tools CLI, or accessed via the MongoDB Shell.

Atlas

Atlas can be accessed using the URL: https://cloud.mongodb.com/user.

Only members of “RMIT” will have access to the “YaMa” project within Atlas.

The database is deployed to MongoCluster0 and is hosted on a shared virtual instance running on AWS.

Mongodb Cluster

To modify or query the “yama” database, click on the “Browse Collections” button and select the “yama” database.

Mongodb Cluster 2

The “yama” database has just three functional collections (or tables in SQL terminology):

  • user: Hold the user data.
  • group: Holds data on groups created by the registered users.
  • channel: Holds data on channels created in a group, as well as the chat messages that have been sent in that channel.

Clicking on the desired collection allows queries to be run on the data, with results displayed below the query box.

Mongodb Cluster 3

MongoDB has a very thorough online manual.

Database Tools CLI

Database dumps for migration and backup can be done using the Database Tools CLI that is available for Linux, MacOS, and Windows systems.

The CLI can be downloaded from here.

The mongodump command can be used to backup or extract the database in the binary JSON format used by mongoDB. This could be used to move the database to another MongoDB account, or migrating to a self hosted server, or just to backup the data.

The command to dump the Yama database is:

mongodump --uri mongodb+srv://rmit:<password>@mongocluster0.3ch0w.mongodb.net/yama

Where <password> is the database password, not your user password.

The database could then be restored from this backup using the command:

mongorestore --uri mongodb+srv://rmit:<password>@mongocluster0.3ch0w.mongodb.net

The database dump to be restored is read from the dump/ sub-directory of the current directory; to restore from a different directory, pass in the path to the directory as a final argument.

If migration to a different database solution is required, the mongoexport command can export the data in CSV or JSON format.

The command to export the database is:

mongoexport --uri mongodb+srv://rmit:<password>@mongocluster0.3ch0w.mongodb.net/yama --collection <collection> --type <filetype> --out <filename>

Where <password> is the database password, not your user password, <collection> is the name of the collection you want to export (the table name), the <filetype> can be "json" or "csv", and <filename> is the name of the file it will be exported to.

Further information on additional commands that may be of use can be found here.

MongoDB Shell

The Yama MongoDB Atlas database can also be accessed and manipulated via a command-line shell interface called mongosh.

The shell application is available for Windows, MacOS, and Linux. You can download the shell from here: https://www.mongodb.com/docs/atlas/mongo-shell-connection/

The command to connect to the Yama database and run commands in the shell is:

mongosh "mongodb+srv://mongocluster0.3ch0w.mongodb.net/yama" --apiVersion 1 --username rmit

You will be prompted for the database password.

For a guide on how to use mongosh, consult the online manual: https://docs.mongodb.com/mongodb-shell/

Compass

MongoDB Compass is a desktop application that can be used to run queries and manage the Yama MongoDB Atlas database. It is available for Linux, MacOS and Windows. You can download the application from: https://www.mongodb.com/products/compass

When you run Compass, you will be prompted to enter a connection string to connect to Atlas. The connection string required is:

mongodb+srv://rmit:<password>@mongocluster0.3ch0w.mongodb.net/yama

Where <password> is the database password, not your user password.

Compass offers a very similar experience to the online interface of Atlas and further information on using Atlas can be found in the online documentation: https://www.mongodb.com/docs/compass/current/

Mongodb Compass