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

pymongo <v3 syntax used #22

Open
ThinkerPal opened this issue Apr 30, 2022 · 1 comment
Open

pymongo <v3 syntax used #22

ThinkerPal opened this issue Apr 30, 2022 · 1 comment

Comments

@ThinkerPal
Copy link

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
Copy link
Owner

NullPxl commented May 3, 2022

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

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