insert_many: unexpected keyword argument 'bypass_document_validation' in calling pymongo `_Bulk`
Versions
txmongo==19.2.0
pymongo==3.0.3
The insert_many method of txmongo.collection.Collection uses
bulk = _Bulk(self, ordered, bypass_document_validation=False)
But the _Bulk method in pymongo 3.0.3 doesn't have the argument bypass_document_validation
class _Bulk(object):
"""The private guts of the bulk write API.
"""
def __init__(self, collection, ordered):
...
This causes the following error on using insert_many
File \"/usr/local/lib/python3.7/site-packages/txmongo/collection.py\", line 824, in insert_many
bulk = _Bulk(self, ordered, bypass_document_validation=False)
TypeError: __init__() got an unexpected keyword argument 'bypass_document_validation'"}
Seems like we need to rise pymongo version in our requirements.txt and setup.py, we are not compatible with 3.0 anymore...
Is it possible for you to use more recent version of PyMongo?
Upgrading pymongo should work, but since it was a large repo and upgrade takes a little time (to go through all usages and changelogs and make changes accordingly), we didn't take that route.
Instead, we just used .insert(list of docs) function for the bulk write which worked fine.