NullPxl / NullCTF

A Discord bot that provides ctf tools for collaboration in Discord servers!
GNU General Public License v3.0
132 stars 52 forks source link

pymongo <v3 syntax used #22

Open ThinkerPal opened 2 years ago

ThinkerPal commented 2 years ago

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

NullPxl commented 2 years ago

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