Similar to display / decrease, but vice versa. Mongo has a way to reformat the 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 in a new format. where each data point in the time series is a document mapped to an identifier, hopefully using some of the built-in mongo features like map reduction. If not; I would 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"}
}
Dap source
share