Closed coca099 closed 1 year ago
I'm really sorry if I'm not doing things correctly, also sorry for the commit mess. I copy pasted the handler to my project and made changes until it ran, hopefully it's of use here.
@coca099 thanks for your effort. Looks OK.
Hi, I find this update very useful and I was wondering if there are plans to make a new release of the module including it. Right now, version 1.7.0
does not include it.
Thank you
Tested on mongodb 6.0.1 and pymongo 4.3.3, should be compatible starting 5.0.0+ and 4.0 respectively. Tested on a DB with authentication enabled but it should work without too hopefully.
Quick disclaimer: I'm a total 0 with Python. Not going to lie, those are hot glued fixes until my debugger stopped turning red, I'm certain there's a better way to do things but at least it runs without crashing from my limited testing. Some of the methods and ways of doing things got changed when going from 4.0 to 5.0 like the way connections/clients are handled so I made some quick change to make it at least run. From what I understood, we shouldn't manage multiple connections from from one MongoClient anymore, methods like authenticate(), logout() and close() have been removed from the pymongo library, there's no connecting and disconnecting to do, authentication is done on the MongoClient object so I moved authentication there. Close() shouldn't be of any use now I think? I just None-d and false-d the relevant variables for now.