A day in the life of a beginner JavaScript backend developer

Divine AmunegaDivine Amunega
2 min read

When I just started NodeJs some months ago, I had a smooth ride, understanding came easily. But one error remains evergreen in my memory. A mongoose error.

While co-coding on a tutorial course with my instructor we were working on a user managment system while learning CRUD (Create, Read, Update, Delete ) operations with Mongoose. The course was quite outdated so I thought it nice to use the docs while coding. He used User.create() to create new users in the database but in the docs I found something better. Or so I thought. Using new User() to create users. But something was wrong.. I was'nt seeing any of my new Users in the database. 😭😭😭

I ran my code checked my schema, checked my connection, restarted Vs-code, Postman, my system.. What did I not do that day. Haa God help me I prayed. Frustration everywhere.

Eventually, I took a break. I went to watch a movie, and then I slept until the evening. I woke up and decided to face my nightmare (no pun intended).

I checked the mongoose docs again and found my solution. I decided to revisit the Mongoose documentation. I quickly realized that while new User() creates a new user instance, it doesn’t save it to the database unless you explicitly call .save().

That was it... I fixed it... That was the only thing I did that day. But at least I was growing and learning at the same time. And that is what matters. That's one of the reasons I joined the https://hng.tech/internship program so I can be pushed to the limits of learning more and growing.

If you wish to learn more about HNG Intership check out https://hng.tech/premium.

So bye.. And have an error free day! πŸ‘‹πŸ‘‹

1
Subscribe to my newsletter

Read articles from Divine Amunega directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Divine Amunega
Divine Amunega

I am a developer from the void.