MongoDB: Date issue when before 1970

落花浮王杯 提交于 2019-12-01 06:51:49

问题


We are using MongoDB 2.4.9 (64 bits) over Windows 7 SP1 (64 bits). When we run the query below and we have any person in our collection with date of birth before the year of 1970 we get the exception "gmtime failed - your system doesn't support dates before 1970".

db.persons.aggregate({
  $project: { 
    date: { 
      year: { $year: "$DateOfBirth" },
      month: { $month: "$DateOfBirth" }, 
      day: { $dayOfMonth: "$DateOfBirth" }
    }
  }
})

I've read in other threads that it's a known issue when running MongoDB on certain Windows versions. Note that our project cannot be deployed in other platform than Microsoft.

来源:https://stackoverflow.com/questions/21869602/mongodb-date-issue-when-before-1970

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!