pymongo.errors.OperationFailure: unsupported type in filter

吃可爱长大的小学妹 提交于 2019-12-08 13:54:29

问题


I am working on Project Django with MongoDB (djongo) and I am using mongo atlas But when I am running this command

 python3 manage.py runserver 
 python3 manage.py makemigrations

this show this type error

 pymongo.errors.OperationFailure: unsupported type in filter

But if I use my local mongod then it's works fine. Please help me

My requirements.txt

    dataclasses==0.6
    dj-database-url==0.5.0
    Django==2.2
    django-cors-headers==3.0.1
    djangorestframework==3.9.4
    djongo==1.2.32
    dnspython==1.16.0
    pymongo==3.8.0
    sqlparse==0.2.4

My Db Setting.py

    DATABASES = {
        'default': {
            'ENGINE': 'djongo',
            'NAME': 'leverrage',
            'HOST': 'mongodb+srv://xxxxxxx:xxxxxxxx@cluster0-dqfd1.mongodb.net/test?ssl=true&ssl_cert_reqs=CERT_NONE&retryWrites=true',
            'USERNAME': 'xxxxxxx',
            'PASSWORD': 'xxxxxx',
            'ENFORCE_SCHEMA': True,
        }
    }

回答1:


Djongo currently is using a deprecated method from pymongo. So I decided to change my pymongo version to the 3.5.1 while djongo fix it.




回答2:


@Luis Javier Palacio

How did you change the pymongo version?

PD: Can't comment on your answer because of reputation. Thats why I'm "answering" the question.




回答3:


@Joaquín Gumucio You can do it using pip like: pip install pymongo==3.5.1



来源:https://stackoverflow.com/questions/56280057/pymongo-errors-operationfailure-unsupported-type-in-filter

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!