Skip to content

Accessing the database

Tom Taylor edited this page Feb 20, 2019 · 6 revisions

This page will give you some basic instructions on how to manually query the database should you need to.

The default database for the authoring tool is MongoDB, so if you're new to mongo, you might want to head over to their official documentation to give yourself the best possible start.

Mongo shell

If you're well-versed in using the command line, you can query the database from the comfort of your favourite terminal application.

Starting the shell

To access the shell, you need to execute the mongo command (on Windows, type mongo.exe). If mongo/mongo.exe is run without any arguments, it assumes that your database is local (localhost port 27017). If this is not the case, you will need to run something like the following:

mongo --host <your_host> --port <your_port>

Once you're running the mongo shell, you should see something like the following:

MongoDB shell version: 2.6.7
connecting to: test
> 

Finding your database

Now you're in the shell, you need to find and connect to the right database before you can start any querying. You can output a list of all databases by running:

show dbs

If you only have a single instance of the Adapt authoring tool, this will likely be adapt-tenant-master. If not, you can check in the <authoring root>/conf/config.json for the dbName. Once you know the name of your database, you can switch to it in the shell using

use <db>

Querying the database

Now you're connected to the database, there's a number of things you can do. You can find all of the information you need in the mongo Shell Quick Reference, but here are a few commands you might find useful:

# shows all collections in the current database
show collections

# returns records in the collection that match the passed search criteria
db.<collection>.find(<search_criteria>)

TODO shell commands

Robo3T

If you prefer interacting with a user-interface to using the command line, we recommend you try Robo3T, which is free, cross-platform and very easy to use.

TODO Robo3T instructions

Clone this wiki locally