[SERVER-1097] mongoimport / export should adhere to CSV spec Created: 06/May/10  Updated: 26/Apr/19  Resolved: 27/Jul/11

Status: Closed
Project: Core Server
Component/s: Tools
Affects Version/s: None
Fix Version/s: 1.9.2

Type: Improvement Priority: Minor - P4
Reporter: Mathias Stearn Assignee: Sridhar Nanjundeswaran
Resolution: Done Votes: 3
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-2357 mongoimport should ignore trailing co... Closed
Duplicate
is duplicated by SERVER-3180 CSV/TSV import split data on line bre... Closed
Related
related to SERVER-2379 mongoimport + csv with commas in valu... Closed
related to SERVER-2634 mongoimport fails to import CSV when ... Closed
is related to SERVER-3936 Weird problem with mongoimport Closed
is related to TOOLS-62 mongoimport doesn't support multiline... Closed
Backwards Compatibility: Major Change
Participants:

 Description   

Right now we use JSON escaping rules for strings rather than CSV rules.

Proposal: Strings (and equivalent types like symbol) and numbers get printed directly in CSV format. Other types like objects or arrays get converted to JSON then run through the CSV escaper so they will be valid JSON strings after an import.

Questions:
Should Code be a String equivalent or JSON?
Should OID's be emited as regular hex strings or csv escaped ObjectID("abcde"). The later preserves the distinction between strings and OIDs, but it will make a terrible key if trying to share data with another DB.



 Comments   
Comment by auto [ 26/Jul/11 ]

Author:

{u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: Part 2 of SERVER-1097: Make mongoexport export valid CSV
Branch: master
https://github.com/mongodb/mongo/commit/bcf0b72b4afcf2cc54feb14300309351f6c3ee69

Comment by auto [ 26/Jul/11 ]

Author:

{u'login': u'stbrody', u'name': u'Spencer T Brody', u'email': u'spencer@10gen.com'}

Message: Part 1 of SERVER-1097: Make mongoimport adhere to CSV spec.
Branch: master
https://github.com/mongodb/mongo/commit/f44433b04cf079fac0300a33798d62a3754af7d3

Comment by Mathias Stearn [ 22/Jun/11 ]

CSV generated with new and old tools will be mutually incompatible.

Comment by Eliot Horowitz (Inactive) [ 10/May/10 ]

Code should be JSON I think
OID should be ObjectID(<hex>)

We should have an option like --csvcompat which can do some nice things

  • auto massage to/from object ids
  • handle dates, parse things that look datish
Generated at Thu Feb 08 02:56:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.