learn hapi — Update Mongoose Models for JSON Responses

While creating the Futureflix API, you noticed that the JSON representation of documents contains the _id and version key __v.

The _id field feels wrong due to the underscore prefix, so let’s remove it and keep only the id field. The version key __v isn’t necessary in the response at all and you want to remove it from the JSON as well.

Alright, let’s tackle this cosmetic part and remove all Monks¹ from the JSON response 😉

¹ Monk is a character in the “Monk” TV show where the person needs to get everything straight and can’t live with some kinks. AS WE DO, so let’s get rid of the underscored fields!

hapi Series Overview


Continue reading

University Enrollment Required

Future Students benefit from value packed videos and tutorials.

Enroll to receive exclusive content or sign in if you’re already a Future Student.

Enroll me for $15/mo

Explore the Library

Find interesting tutorials and solutions for your problems.