---
# System prepended metadata

title: COSC 61 Lab 4

---

# COSC 61 Lab 4
## Leo Bueno & Ben Korkowski (11/14/22)


### How to run: 
To test run our file using .in and .out files, we ask that you complete the following procedure: 
1. Have the blog_engine.py and testfile.in in the same directory 
2. Using the command line type in:
```
python blog_engine.py < testefile.in &> tesfile.out
```
4. Compare your testfile.out with our submitted version for differences

If you would woud like to run the interface with no prespecified input but rather a clean slate just run the python file as normal. 
```
python blog_engine.py
```
Note: if you would like to gracefully exit the stdin, you can type in "exit" to end the while loop running our program.

### Testing:
The testing file provided tests all possible inputs to test every case for the database. This includes: insert post with permalink, inserting post without permalink, commenting on a post, commenting on a comment, commenting without a permalink, show blog, find based on body, tag, and comment, delete a post, delete a comment, and exiting. In addition, we test edge cases such as when an invalid permalink is provided for either commenting or deleting. 

### Files:
- blog_engine.py
    - front end file to send commands to database
- testfile.in
    - test file to run to check if program works
- testfile.out
    - output file of testfile.in
- config.ini
    - configuration file for access

### Assumptions
- There is a maximum of two layers when it comes to post comments (aka, there is a max of a comment on a comment)
- Permalinks provided are unique
- Format of timestamp is ISO
- Each new start of our program resets our database to tabula rasa format
- Blog names are unique
- If a timestamp is not provided, our program will use the current time as a subsitute 
- Due to our timestamps being specified to the microsecnd, we do not account for comments who could potentially have the exact same permalink due to the unlikelihood of overlap
- No duplicate entries will be inputted
- When deleting a post/comment, the timesamp is updated to the current stamp rather than a new key value pair being inserted.

### Extra credit 
As can be seen in our testing script, we also attempted to implement the extra credit searching functionality. We achieved this by creating a Mongo index that allowed for easy searches. Additional tests can be ran at your convienence. 