fix: remove hack that seems to have no upside (COMPASS-4987) #2414
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A better explanation of the bug is if you import fields with names that contain non-ascii characters, then those will always import as strings, no matter what you select in the dropdown.
Uncommenting this debug call it prints
{“keyPathToTransform”:{“”:“Number”},“keyPath”:“价格“}
. See that it made the path a blank string. It clearly stripped all non-ascii characters when it tried to turn it into dot notation.That happened here
Here you can see where that change was introduced: https://github.com/mongodb-js/compass-import-export/pull/18/files#diff-66ee9e953feb4b9aaa484b3de0e43691c40b17b124bc2c4a15abf0b5ffdc363bR61-R63
Then questioned with no explanation given, then just merged anyway:
Then eventually the TODO message just got deleted, again with no explanation given. Somewhere in this PR 45cd5bf#diff-517194336722d4801481b2c8225a2ba2d2491f2f5e42a59ad1497692589f4119
Mongodb has no issue with chinese characters in the field names. I confirmed this by importing the data using
mongoimport
.This PR removes the line that strips all that and then that fixes the problem. I can now import that CSV file using compass and it keeps and uses the field types you manually assign.
So.. I don't know. Go with this until something breaks again and then next time properly document it, explain why and add tests?