Similar to map/reduce but in reverse. Does mongo have a way of reformatting data. I have a collection in the following format.
{
{"token-id" : "LKJ8_lkjsd"
"data": [
{"views":100, "Date": "2015-01-01"},
{"views":200, "Date": "2015-01-02"},
{"views":300, "Date": "2015-01-03"},
{"views":300, "Date": "2015-01-03"}
]
}
}
I would like to process the entire collection into a new format. where every time series data point is its document mapped to the ID hopefully using some inherent mongo functionality similar to map reduce. If there isn't; I'd appreciate a strategy in which we can do this.
{
{ "token-id" : "LKJ8_lkjsd", "views": 100, "Date" : "2015-01-01"},
{ "token-id" : "LKJ8_lkjsd", "views": 200, "Date" : "2015-01-01"},
{ "token-id" : "LKJ8_lkjsd", "views": 300, "Date" : "2015-01-01"}
}