🌟 learn hapi — Update Mongoose Models for JSON Responses

🌟 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!

To continue reading this premium tutorial go to futurestud.io!

Please follow and like us:

Gurupriyan is a Software Engineer and a technology enthusiast, he’s been working on the field for the last 6 years. Currently focusing on mobile app development and IoT.