NullCTF icon indicating copy to clipboard operation
NullCTF copied to clipboard

pymongo <v3 syntax used

Open ThinkerPal opened this issue 2 years ago • 1 comments

The Issue

When attempting to self-host this bot (by building the docker image), I came across an issue where the bot threw out errors about TypeError: 'Collection' object is not callable. If you meant to call the 'update' method on a 'Collection' object it is failing because no such method exists., and I was not seeing any data written to the database.

Hosting

I'm running monogdb with the latest docker image (id: 20106db9aa7a) and connecting the two containers via a shared docker network.

A possible...solution?

From what I understand from the interwebs, this is due to pymongo changing the syntax for updating a collection to use .update_one() or .update_many() from v3.x onwards. (or at least what I think this is what the issue was)

Running the bot with pymongo 2.9.5 (the last version before pymongo 3.0) clears up the issues that I was facing. (changing requirements.txt:2 to pymongo==2.9.5)

(not to say we should be running a library that was built in 2015, but this seemed like the easiest method to get the bot up and running without any code changes so ¯\_(ツ)_/¯ )

~~alternatively, if there are plans to update the bot, then the above can probably be ignored lol~~

ThinkerPal avatar Apr 30 '22 13:04 ThinkerPal

Thanks for the insight, I was not aware of this! Since the goal is eventually to re-write the bot with slash commands this will get lumped in with that when I get the time :')

Thanks again for taking the time to add detail

NullPxl avatar May 03 '22 02:05 NullPxl