My Upcoming data is :
{
id: 123
contact: 4591112365
address: Block C New York
firstname: John
lastname: Wick
}
Now on inserting data using Mongoose on Mongodb, I want my data to be inserted as this:
{
id: 123
contact: 4591112365
information:{
address: Block C New York
firstname: John
lastname: Wick
}
}
I am using NodeJs and don't want to programmatically map the data, I want when I insert data in the above format it will automatically map to below one, I Think Using mongoose schema and virtual function or virtual ID I can do that but I am not sure about how to do that.