-
Type: Bug
-
Resolution: Won't Fix
-
Priority: Major - P3
-
None
-
Affects Version/s: 3.6.1
-
Component/s: API
-
None
-
Environment:$ python -c "import sys; print(sys.version)"
3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609]
$ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
3.6.1
True
$ cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
$ mongod --version
db version v3.6.3
git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5
OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016
allocator: tcmalloc
modules: none
build environment:
distmod: ubuntu1604
distarch: x86_64
target_arch: x86_64
$ python -c "import sys; print(sys.version)" 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())" 3.6.1 True $ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS" $ mongod --version db version v3.6.3 git version: 9586e557d54ef70f9ca4b43c26892cd55257e1a5 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 allocator: tcmalloc modules: none build environment: distmod: ubuntu1604 distarch: x86_64 target_arch: x86_64
-
(copied to CRM)
When importing data into mongo using pymongo and .insert, it would fail with the error:
bson.errors.InvalidDocument: key <REDACTED> must not contain '.'
If we added check_keys=False to the .insert, it would allow the data to continue to be imported:
collection.insert(json.loads(mongo_record),check_keys=False)
However when we swapped to using .insertmany, there is no check_keys=False option to be passed:
collection.insert_many(mongo_records,ordered=False,bypass_document_validation=True)
Traceback:
{{Traceback (most recent call last): File "../../fetch2.py", line 264, in <module> main() File "../../fetch2.py", line 255, in main collection.insert_many(mongo_records,ordered=False,bypass_document_validation=True) File "/usr/local/lib/python3.5/dist-packages/pymongo/collection.py", line 742, in insert_many blk.execute(self.write_concern.document, session=session) File "/usr/local/lib/python3.5/dist-packages/pymongo/bulk.py", line 432, in execute return self.execute_command(generator, write_concern, session) File "/usr/local/lib/python3.5/dist-packages/pymongo/bulk.py", line 323, in execute_command self.is_retryable, retryable_bulk, s, self) File "/usr/local/lib/python3.5/dist-packages/pymongo/mongo_client.py", line 1079, in _retry_with_session return func(session, sock_info, retryable) File "/usr/local/lib/python3.5/dist-packages/pymongo/bulk.py", line 318, in retryable_bulk retryable, full_result) File "/usr/local/lib/python3.5/dist-packages/pymongo/bulk.py", line 278, in _execute_command self.collection.codec_options, bwc) bson.errors.InvalidDocument: key <REDACTED> must not contain '.'}}
- related to
-
SERVER-30575 Please add escaping convention for dot and dollar signs!
- Backlog