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 has no attribute collection #246

Open
uniqueg opened this issue Dec 12, 2024 · 0 comments
Open

pymongo has no attribute collection #246

uniqueg opened this issue Dec 12, 2024 · 0 comments
Labels
flag: good 1st issue Good for newcomers priority: high High priority type: bug Something isn't working workload: hours Likely takes hours to resolve

Comments

@uniqueg
Copy link
Member

uniqueg commented Dec 12, 2024

When using PyMongo 4.10.1, apps using FOCA throw the following error:

  File "/usr/local/lib/python3.10/site-packages/foca/__init__.py", line 3, in <module>
    from foca.foca import Foca  # noqa: F401
  File "/usr/local/lib/python3.10/site-packages/foca/foca.py", line 10, in <module>
    from foca.security.access_control.register_access_control import (
  File "/usr/local/lib/python3.10/site-packages/foca/security/access_control/register_access_control.py", line 15, in <module>
    from foca.models.config import (
  File "/usr/local/lib/python3.10/site-packages/foca/models/config.py", line 898, in <module>
    class CollectionConfig(FOCABaseConfig):
  File "/usr/local/lib/python3.10/site-packages/foca/models/config.py", line 923, in CollectionConfig
    client: Optional[pymongo.collection.Collection] = None
AttributeError: module 'pymongo' has no attribute 'collection'

This does not occur with PyMongo 4.7.0, where pymongo.collection exists.

It appears that somewhere along the line between 4.7 and 4.10, PyMongo removed the top-level collections module.

Quick workaround for apps using FOCA: Add pymongo==4.7 to your requirements.

@uniqueg uniqueg added flag: good 1st issue Good for newcomers priority: high High priority type: bug Something isn't working workload: hours Likely takes hours to resolve labels Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flag: good 1st issue Good for newcomers priority: high High priority type: bug Something isn't working workload: hours Likely takes hours to resolve
Projects
None yet
Development

No branches or pull requests

1 participant