-
Type:
Bug
-
Resolution: Duplicate
-
Priority:
Major - P3
-
None
-
Affects Version/s: 3.2.8
-
Component/s: mongoimport
-
None
-
Environment:Customer found this on Windows. I reproduced it on OS X.
Create a file in CSV or TSV format, with a header line, with a UTF-8 Byte Order Mark at the beginning (0xefbbbf). See such a file attached. mongoimport --type tsv --headerline on the file into a collection.
Note that the first field's name in the database has a UTF-16 BOM in front of it. This is invisible during normal shell work, but it's there and prevents queries on that field from working. Here's a terminal session showing the issue.
mongoimport --db test --collection foo --file jets_agency_systems.html --type tsv --headerline
mongo
MongoDB shell version: 3.2.8
connecting to: test
> db.foo.findOne()
{
"_id" : ObjectId("57ab94a12486607096162845"),
"ID" : "C",
"AGENCY_TEXT" : "US AIR FORCE"
}
> db.foo.find({ID:'C'})
> db.foo.find({"\ufeffID":'C'})
{ "_id" : ObjectId("57ab94a12486607096162845"), "ID" : "C", "AGENCY_TEXT" : "US AIR FORCE" }
>
- duplicates
-
TOOLS-879 UTF-8 bom is not ignored in mongoimport
-
- Closed
-