I am trying to use an aggregate function to group date fields by year:
db.identities.aggregate([ { $group : { _id : { year : {$year : "$birth_date"}}, total : {$sum : 1} } } ])
Some of my dates, however, fall before 1970 and are Windows users, I get an unpleasant error in gmtime:
{ "errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970", "code" : 16422, "ok" : 0 }
I know that the obvious answer is now for me to start a virtual machine or something like that, but I was just curious if there were any problems for Windows (Windows 7 in my case). If you cannot save maximum performance as a nested object, then ie:
birth_date : { year : 1980, month : 12, day : 9 }
I'm not too sure how much this would be with indexes, etc.
Any advice appreciated!
javascript mongodb
backdesk
source share