Holy smokes, Bat-viewers! Today’s adventure took me down a rabbit-hole and then up out of an ant-hole.
So our focus this week has been on databases. Coolness - the stacks are really starting to feel complete. Today was our second (and final) day with Mongo. Our task for the day was to complete a functional backend and then modularize it. I struggled with some of the syntax to get the backend up and running, but lunch and asking the right people the right questions helped and I was finally up and running. Then I started to modularize my code. I kept getting informative error after informative error. I went through about a dozen silly little things in about five minutes. And then — brick wall! After staring helplessly at the error, not really understanding how I could get such an error, I sought our instructor’s assistance. Unfortunately, it was right at the end of class and he had to leave. So I was stuck with it.
Symptoms
Code functioned as expected when I had it in a single file, but when I broke it out into modules I got …
|
|
with a reference line to a line like …
|
|
Mind you, the find
function had worked fine until I modularized my code.
Mistake
All of my instructor’s and my googling skills kept turning up discussions, explanations, and examples of static versus instant methods in mongoose and mongodb [1].
Turns out, it was a singular versus plural problem. In my MongooseSchemaModule.js file I had used …
|
|
instead of …
|
|