summaryrefslogtreecommitdiff
path: root/src/mongo/tools
diff options
context:
space:
mode:
authorShaun Verch <shaun.verch@mongodb.com>2014-05-13 17:01:04 -0400
committerShaun Verch <shaun.verch@mongodb.com>2014-05-23 16:59:25 -0400
commit99fa4e6058a24d6c4d7fde19ce940719c5bbc210 (patch)
tree2d00e63c2a942d246053d88fd663bf6dbcc511a2 /src/mongo/tools
parented71c30430f538b9209d35278ca176696c5bb294 (diff)
downloadmongo-99fa4e6058a24d6c4d7fde19ce940719c5bbc210.tar.gz
SERVER-13760 Do not call dateToISOString if date is not formatable
Diffstat (limited to 'src/mongo/tools')
-rw-r--r--src/mongo/tools/export.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mongo/tools/export.cpp b/src/mongo/tools/export.cpp
index 5e9bca22432..75460f76a15 100644
--- a/src/mongo/tools/export.cpp
+++ b/src/mongo/tools/export.cpp
@@ -92,7 +92,10 @@ public:
case jstOID:
return "ObjectID(" + object.OID().toString() + ")"; // OIDs are always 24 bytes
case Date:
- return dateToISOStringUTC(object.Date());
+ // We need to check if we can actually format this date. See SERVER-13760.
+ return object.Date().isFormatable() ?
+ dateToISOStringUTC(object.Date()) :
+ csvEscape(object.jsonString(Strict, false));
case Timestamp:
return csvEscape(object.jsonString(Strict, false));
case RegEx: