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

mongoexport should export date types with milliseconds in csv mode

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.3
    • Affects Version/s: 2.4.3
    • Component/s: Tools
    • Labels:
      None
    • ALL
    • 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

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

            Assignee:
            sverch Shaun Verch
            Reporter:
            michael.grundy Michael Grundy
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: