How can I aggregate my MongoDB results by ObjectId date. Example:
Default cursor results:
cursor = [
{\'_id\': ObjectId(\'5220b974a61ad0000746c0d
So this doesn't answer my question directly, but I did find a better way to replace all that lambda nonsense above using Python's setdefault:
d = {}
for message in messages:
key = message['_id'].generation_time.date()
d.setdefault(key,[]).append(message)
Thanks to @raymondh for the hint in is PyCon talk:
Transforming Code into Beautiful, Idiomatic Python