I came across this excellent MongoDB routing guide for ExpressJS/Node servers. However, I think this was written using an older version of the mongodb node driver (pre-3.0?) as it refers to a database object being returned on the connect callback and not a client. I kearned this after troubleshooting this set up since yesterday. The db object worked so far as the connect method was concerned, but when it came time to retrieve and display documents, I kept getting the following errors:
I spent hours trying to work through the routing to understand why my GET route wasn't working. Fucking HOURS. And it finally dawned on me that maybe it wasn't an issue with variable reassignment, but with how I was sending the data to the frontend. The solution was *almost* infuriating: upon changing "res.send" to "res.render", everything worked as expected.
Now time to begin developing the render pages and understanding how to separate and display the data stored in the various properties in each database document. But first, a nice long brain break.