Skip to content

pymongo <v3 syntax used #22

@ThinkerPal

Description

@ThinkerPal

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions