-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.2.7
-
Component/s: mongoimport
-
None
mongoimport allows fields with dots "." to be imported
An input file as:
{ "a.b" : 1 } { "a.b" : 2 }
is imported without errors/warnings:
$ mongoimport -d test -c test import.json
connected to: 127.0.0.1
2016-07-18T10:58:58.382+1000 imported 2 objects
$
The collection looks like:
{ "_id": ObjectId("578ec46e39b3c19fbbeb2264"), "a.b": 1 } { "_id": ObjectId("578ec46e39b3c19fbbeb2262"), "a.b": 2 }
Testing with 3.2.7, 3.0.8, 2.6.11 and 2.4.14 produced the same results.
Only 2.5.2 shows errors when importing:
$ mongoimport -d test -c test import.json connected to: 127.0.0.1 2016-07-18T10:56:05.626+1000 error: Cannot insert object with _id field of array/regex or with any field name prefixed with $ or containing a dot. 2016-07-18T10:56:05.627+1000 error: Cannot insert object with _id field of array/regex or with any field name prefixed with $ or containing a dot. 2016-07-18T10:56:05.627+1000 tried to import 2 objects 2016-07-18T10:56:05.627+1000 ERROR: encountered at least 2 error(s)s $
Both TOOLS-57 and TOOLS-64 say that they should be imported as an embedded object but this doesn't seem to be the case.
In addition, once the documents are imported, they cannot be $renamed due to SERVER-25164
- depends on
-
GODRIVER-998 Driver should not allow insertion of docs with dots in keys
- Closed
- is duplicated by
-
TOOLS-1736 mongoimport should prohibit dotted field names
- Closed
- is related to
-
SERVER-25164 $rename doesn't rename fields with dots (.)
- Closed