From e6ce054fee5dee068700795b5e8a18e9a61c3d15 Mon Sep 17 00:00:00 2001 From: Luke Berndt Date: Mon, 15 Feb 2021 08:41:48 -0500 Subject: [PATCH] Update README.md --- README.md | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/README.md b/README.md index deac768..365bb58 100644 --- a/README.md +++ b/README.md @@ -118,3 +118,38 @@ This should build the frontend and open a browser. In order to have all the cook ### Mailjet Sign up for MailJet! https://www.mailjet.com + + +### Managing MongoDB + +MongoDB is used in the backend to store data. It is pretty fast, flexible and has worked well enough for me. +All of the files that MongoDB uses to store the DB are in the */data* directory, which gets mapped into the contianer. +Mapping this directory makes sure that the data persists each time you run the mongo container. + +#### Working with the MongoDB Container + +From the Host OS run: +```bash +docker exec -i -t $(docker ps -a | grep mongo | awk '{print $1}') /bin/bash +``` + +There are a few scripts included with the container: +- **clean.js** This script removes all Calls that are over 30 days old +- **totals.js** Lists different system stats + + + +#### Compact a collection +When you run clean.js it doesn't actually remove the files off storge. You can use this command from the mongo cli tool. + +First, launch the tool: `mongo` +Then switch to the scanner db: `use scanner` +And then the compact command on the **Calls** collection: + +``` +db.runCommand({compact:'calls'}) +``` + +This blocks all calls to the DB + +