Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert_many: unexpected keyword argument 'bypass_document_validation' in calling pymongo _Bulk #277

Open
vestronge opened this issue Sep 7, 2021 · 2 comments

Comments

@vestronge
Copy link

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'"}
@IlyaSkriblovsky
Copy link
Contributor

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?

@vestronge
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants