Serialization of an Object

can you exaplain or share some good blogs related to serialization and deserialization of an object

Challenge: Serialization of a User Object

Link to the challenge:

Hello there,

A decent place to start is the Passport Docs. At least from there, searching the buzzwords related to serialisation will get you into a useful rabbit-hole.

Hope this helps

2 Likes

From my understanding Serialization is converting an entire object into a small piece of data like a string for easy storage.
In this case only the user’s id from the document is saved into the cookie.
When we deserialize, we can use this small piece of data to get back the original data.
In this case, use our id to fetch the entire user document from the database.

I personally found the official passport docs to be a really bad place to learn. I recommend you look at these alternative docs, where each function is explained clearly:

1 Like