mongodb/mongo — pull request #759 by tonygambone (2014-08-27 02:55:22+00:00)
Title: SERVER-2604 Import TSV files the same as CSV files.

This patch makes mongoimport treat TSV and CSV files the same way when importing. Currently, for TSV, it will import the quotes in quoted fields, and it does not treat tabs within quoted fields as text (e.g. "foo" becomes { "field": "\"foo\"" } and "foo\tbar" becomes { "field1": "\"foo", "field2": "bar\"" }.

The referenced issue mentions a test case where the tab character is escaped by a backslash; this is incorrect TSV as far as I can tell and so this patch does not address that case.

The current behavior for TSV strips leading non-tab whitespace before tokenizing; I have removed that in this patch as well to make it consistent with the CSV handling. I am not sure it is correct to strip these characters but maybe there is a use case I'm not aware of.