DEV Community

Discussion on: Coding 🤦‍♂️

sainig profile image
Gaurav Saini

SIGH here it is
We use custom es6 classes on top of mongoose models as a wrapper to sort of abstract out the existence of mongodb from our route handlers. I had to store additional info on one of the models so I wrote logic for it and tested out my api endpoint.
I WAS SHOCKED - no new info in the database
I thought I didn’t save my work or didn’t wait for the server restart (yes, I do that sometimes), but it was not the case

After banging my head and pulling my hair for around 1 hr I realised that I didn’t add the field to my es6 wrapper classes so they prevented the data from being passed on to the mongoose model. Silly me

michaelphipps profile image
Phippsy Author

GAh! I use a similar style architecture for my backend in PHP and MySQL. I've had similar experience as a result, although maybe not 1 hour. (Probably longer!)

Something annoying is that once I solve problems like this my colleague always says "Well done! You worked it out" (in a sincere way, not sarcastic). Drives me nuts. I shouldn't have missed it in the first place! I could have spent the time watching TV and been just as productive.