Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-9648

mongoexport should export date types with milliseconds in csv mode

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.4.3
    • Fix Version/s: 2.5.3
    • Component/s: Tools
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      mongos> use test
      switched to db test
       
      mongos> db.test.save({d1:Date(), d2:ISODate()})
       
      mongos> db.test.find().pretty()
      {
      	"_id" : ObjectId("518c069cf87f2f3f9fd6daf8"),
      	"d1" : "Thu May 09 2013 16:27:08 GMT-0400 (EDT)",
      	"d2" : ISODate("2013-05-09T20:27:08.460Z")
      }

      mongoexport in json mode:

      mongoexport -d test -c test
      connected to: 127.0.0.1
      { "_id" : { "$oid" : "518c069cf87f2f3f9fd6daf8" }, "d1" : "Thu May 09 2013 16:27:08 GMT-0400 (EDT)", "d2" : { "$date" : 1368131228460 } }

      In --csv mode:

      $ mongoexport  -d test -c test --csv -f _id,d1,d2
      connected to: 127.0.0.1
      _id,d1,d2
      ObjectID(518c069cf87f2f3f9fd6daf8),"Thu May 09 2013 16:27:08 GMT-0400 (EDT)",2013-05-09T20:27:08Z
      exported 1 records

      Show
      mongos> use test switched to db test   mongos> db.test.save({d1:Date(), d2:ISODate()})   mongos> db.test.find().pretty() { "_id" : ObjectId("518c069cf87f2f3f9fd6daf8"), "d1" : "Thu May 09 2013 16:27:08 GMT-0400 (EDT)", "d2" : ISODate("2013-05-09T20:27:08.460Z") } mongoexport in json mode: mongoexport -d test -c test connected to: 127.0.0.1 { "_id" : { "$oid" : "518c069cf87f2f3f9fd6daf8" }, "d1" : "Thu May 09 2013 16:27:08 GMT-0400 (EDT)", "d2" : { "$date" : 1368131228460 } } In --csv mode: $ mongoexport -d test -c test --csv -f _id,d1,d2 connected to: 127.0.0.1 _id,d1,d2 ObjectID(518c069cf87f2f3f9fd6daf8),"Thu May 09 2013 16:27:08 GMT-0400 (EDT)",2013-05-09T20:27:08Z exported 1 records

      Description

      mongo export in csv mode doesn't export date fields with millisecond resolution as it does for json.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: