I am trying to format some data from Mongo into a CSV. One of the fields is stored as an ISODate, so when querying Mongo, comes out like this:
... ISODate("2011-11-19T00:23:38.786Z") ...
I have a command like the following:
C:\Mongo\bin\mongoexport --csv -f "DOB","Name","Email" -c People -d PeopleDataStore -h [hostname]
This MongoExport command produces something like the following:
{ "$date" : 1321579509347 },"Bob","test@test.com"
How can I get the date that is the output of MongoExport to come out like “2011-11-19T00:23:38.786Z”, i.e. not an integer representation, and not wrapped in code structures?
Note that I am attempting to do all this from the command line, not from within an application that could process the results. An application will be my fallback plan.
Don’t think this is possible using just
mongoexporton it own, you’ll need to write your own little export script or post-process the date values to convert from the integer (milliseconds since 1 January 1970) to the ISO string format.