With documents like:
{
_id: 123,
events: {
someEvent:{
created: ISODate("2015-06-27T16:51:03.000Z"),
metadata: {
some: "thing"
}
},
anotherEvent:{
created: ISODate("2015-06-27T16:51:01.000Z"),
metadata: {
some: "thing"
}
}
}
}
This is a simplified example of the data. The events object can have between 200 and 3,000 fields. There are thousands of documents like this.
I'm looking to use mapreduce on the collection so I only return one of the events (the one with the latest 'created' date) for each document in the collection.
Is this possible?