twisted / txmongo

asynchronous python driver for mongo
https://txmongo.readthedocs.io
Apache License 2.0
338 stars 102 forks source link

insert_many does not work properly #266

Closed hoseinalirezaee closed 4 years ago

hoseinalirezaee commented 4 years ago

I use something like the following code to insert into database using bulk mode:

mongodb_connection = ConnectionPool('mongodb://username:123456@localhost:27017')
collection = mongodb_connection['test']['test']
docs = [{'Hello1': 'Hello'}, {'Hello2': 'Hello'}]
dfd = collection.insert_many(docs)
dfd.addBoth(lambda r: print(r)).addBoth(lambda _: reactor.stop())
reactor.run()

But when I run the above code, I get the following error:

[Failure instance: Traceback: <class 'TypeError'>: _check_command_response() missing 1 required positional argument: 'max_wire_version'
txmongo/protocol.py:308:handle
txmongo/protocol.py:437:handle_REPLY
twisted/internet/defer.py:460:callback
twisted/internet/defer.py:568:_startRunCallbacks
--- <exception caught here> ---
twisted/internet/defer.py:654:_runCallbacks
txmongo/collection.py:1397:accumulate_result
]

The version of txmongo is 19.2.

IlyaSkriblovsky commented 4 years ago

What version of PyMongo do you have installed?

hoseinalirezaee commented 4 years ago

My pymongo version is 3.11

IlyaSkriblovsky commented 4 years ago

@hoseinalirezaee We use several internal functions from pymongo and every time it bites when the next version of pymongo changes their signatures :(

Could you please try to downgrade pymongo to 3.10 or 3.9? I'm sure it works with 3.9, not so sure about 3.10.

I will try to fix compatibility with 3.11 within a couple of days.

hoseinalirezaee commented 4 years ago

It works well on pymongo 3.10, but not 3.11. Thanks for your attention. I am waiting for your fix.

IlyaSkriblovsky commented 4 years ago

Sorry for the delay. Could you please test code from #267 with PyMongo 3.11? As far as I'm testing it, it works well now.

hoseinalirezaee commented 4 years ago

yes. I ran all my test cases and they all passed successfully. Thanks.