Skip to content

“Back Door” to the Database

Amanda Bak edited this page Nov 25, 2019 · 4 revisions

For a full briefing of this feature, please visit the 19F handoff document.


One feature that was requested by the partner is the ability to directly edit the database via some back-door interface. Our MongoDB provider, mLab, provides this out-of-the-box!

Visit www.mlab.com and log in with the credentials we provide. mLab allows users to view, search, and edit the database directly.

When you log in, you will be presented with the list of databases you have access to. In mLab’s language, this is called a “deployment.” Our deployment is called “heroku_cdlx19v1.” Once you select our deployment, you will be shown our list of “collections.” You can think of as analogous to a “table” in SQl.

We have two collections, “historicals” and “trappings.” Trappings is a collection that we used last term, but have largely abandoned. We’ve kept it around for legacy purposes, but it is not used. Historicals collects all the relevant data for our application.

If you click through to the historicals, you will see the list of “documents” within the historicals collection. Documents are analogous to a row in a table. You can directly edit a document by clicking one of the rows. You add a new document by clicking “Add document” in the top right corner. All documents are expressed in JSON format.

However, note that the mLab interface is good for inputting a few documents at a time. In order to upload several documents to the database at once, we’ve created a separate script which will allow you to achieve this with a CSV (discussed below).

Finally, you can search a document by using the drop-down menu in the top left. The query is also expressed in JSON format. You can also save searches for ease of repeat use.

Mass-Upload to the Database

Since mLab does not easily support mass uploading of data to the database, we have created a script which makes this easier. It accepts a csv file and will upload the chosen csv to the database. Note that the script will blindly insert data. It will not update previous data to have new values.

For more information on this feature, please see the README.