When will Meteor run Mongo 3? Major date issue with 2.6



I am running in a major issue with date capabilities of Mongo 2.6 that is provided with Meteor 1.2.

To clarify, I store Dates in of documents as ISO Date

new Date('2015-04-01 00:00:00')
which becomes

This is all fine and dandy because now I can use the `$month` aggregation operator.
However the big problem arises when I want to group the records per month.
The April 1st converted to March 31 in the ISODate format. So when I do my group by $month, all April 1st records are counted for March and not for April.
Mongo 3.0 has `dateToString` which might make it possible to convert it back to a GMT(n) timezone so that I can do a count.

To fix it now, I dropped the ISODATE format and just store it as `2015-04-01T00:00:00+1100`.
To count the mounts I have to use 
    $group: {
      _id: {
        month: {
          $substr: ["$Start Date",5,2]
        year: {
          $substr: ["$Start Date",0,4]
      'count': {
        $sum: 1
which looks silly to me.

Any suggestions?


Perhaps you could try wrapping moment() around your date query before you pass it to Mongo? Something like moment(myDateQuery).toDate() or moment(myDateQuery).toISOString(). Or even moment.tz to deal with timezones if that doesn’t work.


I don’t think that works.
The point is that I have to store it as ISODate in Mongo.
However, when it is an ISODate, in current mongo 2.6 you can’t convert it to other timezones.
I for example are in Australia, but I store the dates at UTC. But when I want to report per month, the dates April 1st are on stored as March 31st 14pm. So that is where things go awry…


Australia here too :smile:
I meant to suggest to convert your query to a UTC ISODate and use it to query Mongo. But I guess that doesn’t work with the way you are using the month aggregator.


Mongo 3.0 has been supported for a while (since Meteor 1.0.4). See this Meteor blog post: