I have such Collection structure
{
"_id" : "12ds5dsfSSFS2sfds",
"name": "Peter Jackson",
"films" : [
{
"name" : "King Kong",
"date" : "2005"
},
{
"name" : "The Hobbit: An Unexpected Journey",
"date" : "2012"
}
]
},
{
"_id" : "HHdfdsBfSSFS2sfds",
"name": "Martin Scorsese",
"films" : [
{
"name" : "Goodfellas",
"date" : "1990"
},
{
"name" : "The Wolf of Wall Street",
"date" : "2013"
}
]
}
What I need is to have sorted list like this:
http://jsfiddle.net/K7VGy/embedded/result/
So, the question is - is it possible to merge all fields from films
arrays, then sort them, based on date
and then pass to template?
Maybe I have chosen the wrong collection structure, and it could be improved somehow?
Any help will be appreciated!