|
I believe this got fixed through https://github.com/mongodb/mongo/commit/9822df6e71b0c5793676f9358e5d212c103c19a7 as part of SERVER-28611
Although it does look like charlie.swanson's comment at https://github.com/mongodb/mongo/commit/9822df6e71b0c5793676f9358e5d212c103c19a7#diff-95abc574b79f05301d8807add70d6961R60 is no longer correct as coerceToTM is gone totally.
|
|
This bug still exists in v3.0.3 on Windows 64 Bit.
Why is this not a priority to fix?
> db.user.aggregate( [ { $project: { month: {$month : "$dateOfBirth"} }} ] )
assert: command failed:
{
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
}
: aggregate failed
Error: command failed:
{
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
}
: aggregate failed
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
at (shell):1:9
2015-07-02T13:59:58.373-0400 E QUERY Error: command failed:
{
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
}
: aggregate failed
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at Function.assert.commandWorked (src/mongo/shell/assert.js:254:5)
at DBCollection.aggregate (src/mongo/shell/collection.js:1278:12)
at (shell):1:9 at src/mongo/shell/assert.js:13
>
|
|
This is happening to me too. I do have a Windows machine, but I do not even have dates that would reach under 1970. All that is necessary is to have a date like this: 1970-01-01 00:00:00.000Z
It does not fail, when I use roboMongo to execute the query, but does happen when I use NetBeans to run a code that executes it with mongo driver.
The query is
|
Query
|
db.record.aggregate([{ "$match" : { "creationDate" : { "$exists" : true} , "recordType" : { "$exists" : true}}}, { "$project" : { "_id" : 0 , "osyear0" : { "$year" : "$creationDate"} , "osdayOfYear0" : { "$dayOfYear" : "$creationDate"} , "os1" : "$recordType"}}, { "$group" : { "_id" : { "osyear0" : "$osyear0" , "osdayOfYear0" : "$osdayOfYear0" , "os1" : "$os1"} , "count" : { "$sum" : 1}}}])
|
The same through code returns the error. Exception in thread "main" com.mongodb.CommandFailureException:
{ "serverUsed" : "localhost:27017" , "errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970" , "code" : 16422 , "ok" : 0.0}
|
|
Reproduction Steps for mongoexport.exe (CSV):
Setup:
Windows 7 Pro - Service Pack 1 (x64)
MongoDB Version 6.0.0
> version()
2.6.0
> use test
switched to db test
> db.testCol.save(
{firstName: "Weeble", lastName: "Bob", dob: new Date("October 13, 1965")}
)
WriteResult(
{ "nInserted" : 1 }
)
c:\mongodb\bin>mongoexport.exe -d test -c testCol -f dob --csv -o output.csv
connected to: 127.0.0.1
2014-05-27T11:57:07.246+0100 Assertion failure (long long)millis >= 0 src\mongo\util\time_support.cpp 627
2014-05-27T11:57:07.273+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x71ca83
2014-05-27T11:57:07.273+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x6c764c
2014-05-27T11:57:07.274+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x6b373a
2014-05-27T11:57:07.277+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x71f555
2014-05-27T11:57:07.280+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x7201dd
2014-05-27T11:57:07.283+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x7203e9
2014-05-27T11:57:07.287+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0xae25ac
2014-05-27T11:57:07.289+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0xae3591
2014-05-27T11:57:07.292+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x6ad0b3
2014-05-27T11:57:07.294+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0x6ad19b
2014-05-27T11:57:07.297+0100 mongoexport.exe mongo::parseNumberFromStringWithBase<unsigned char>+0xb185a3
2014-05-27T11:57:07.301+0100 kernel32.dll BaseThreadInitThunk+0xd
2014-05-27T11:57:07.303+0100
assertion: 0 assertion src\mongo\util\time_support.cpp:627
|
|
Reproduction Steps for aggregation framework:
Setup:
Windows 7 Pro - Service Pack 1 (x64)
MongoDB Version 6.0.0
> version()
2.6.0
> use test
switched to db test
> db.testCol.save(
{firstName: "Weeble", lastName: "Bob", dob: new Date("October 13, 1965")}
)
WriteResult(
{ "nInserted" : 1 }
)
> db.testCol.aggregate( { $project : { dobYear : {$year : "$dob"}, dobMonth : {$month : "$dob"} }} )
assert: command failed: {
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
} : aggregate failed
Error: command failed: {
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
} : aggregate failed
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at Function.assert.commandWorked (src/mongo/shell/assert.js:244:5)
at DBCollection.aggregate (src/mongo/shell/collection.js:1149:12)
at (shell):1:12
2014-05-27T10:02:14.364+0100 Error: command failed: {
"errmsg" : "exception: gmtime failed - your system doesn't support dates before 1970",
"code" : 16422,
"ok" : 0
} : aggregate failed at src/mongo/shell/assert.js:13
|
|
According to SERVER-11254, this may not be limited to the aggregation framework. In fact, the aggregation framework may just be one of the few places where we are checking return values for errors and raising exceptions. Feel free to adjust the server component as necessary.
|
Generated at Thu Feb 08 03:29:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.