How to parse stringified version of document in key and values pairs with type in MongoDB?

Problem Statement

We have following JSON object in stringified format. Convert that into document i.e. in key value pair

{"_id":{"$oid":"602e693f7e8df9001191c1a1"},"title":"Inception",
"release_year":2010,"director":"Christopher Nolan",
"genres":["Action","Adventure","Sci-Fi"],
"cast":["Leonardo DiCaprio","Joseph Gordon-Levitt","Ellen Page"],
"plot":"A thief who enters the dreams of others to steal their secrets from their subconscious.",
"ratings":{"imdb":8.8,"rotten_tomatoes":87,"metacritic":74},
"box_office":{"budget":160000000,"gross":829895144}}

To learn more about ObjectId see : All about ObjectId in MongoDB.

Solution

EJSON.parse({"_id":{"$oid":"602e693f7e8df9001191c1a1"},"title":"Inception",
                "release_year":2010,"director":"Christopher Nolan",
                "genres":["Action","Adventure","Sci-Fi"],
                "cast":["Leonardo DiCaprio","Joseph Gordon-Levitt","Ellen Page"],
                "plot":"A thief who enters the dreams of others to steal their secrets from their subconscious.",
                "ratings":{"imdb":8.8,"rotten_tomatoes":87,"metacritic":74},
                "box_office":{"budget":160000000,"gross":829895144}})