insert_many() fails on inserts when connected to mongos. The same code completes successfully when using standalone instance. This seems to be python module issue. insert_many in ruby gem works as expected.
Earlier version of the module (3.7) also worked fine, but I can't downgrade due to a non-related issue.
Here is a minimal example demonstrating the issue:
from pymongo import MongoClient
client = MongoClient(host = "localhost", port = 27017)
db = client["test"]
coll = db["coll"]
data = [\{"a":1},\{"a":2}]
coll = coll.insert_many(data)
Output from the code:
{{{{$ python3 ./test.py }}}}
{{Traceback (most recent call last):}}
{{ File "./test.py", line 7, in <module>}}
{{ coll = coll.insert_many(data)}}
{{ File "/usr/local/lib64/python3.6/site-packages/pymongo/collection.py", line 758, in insert_many}}
{{ blk.execute(write_concern, session=session)}}
{{ File "/usr/local/lib64/python3.6/site-packages/pymongo/bulk.py", line 511, in execute}}
{{ return self.execute_command(generator, write_concern, session)}}
{{ File "/usr/local/lib64/python3.6/site-packages/pymongo/bulk.py", line 349, in execute_command}}
{{ _raise_bulk_write_error(full_result)}}
{{ File "/usr/local/lib64/python3.6/site-packages/pymongo/bulk.py", line 140, in _raise_bulk_write_error}}
{{ raise BulkWriteError(full_result)}}
{{pymongo.errors.BulkWriteError: batch op errors occurred}}
- is depended on by
-
DRIVERS-699 Raise an actionable error message when retryWrites fails due to using an unsupported storage engine
- Closed
- related to
-
PYTHON-1934 Raise an actionable error message when retryWrites fails due to using an unsupported storage engine
- Closed
-
SERVER-44591 Unhelpful error message about transactions in a sharded cluster with a standalone shard when trying to use retryable writes
- Open