BeanieODM / beanie

Asynchronous Python ODM for MongoDB
http://beanie-odm.dev/
Apache License 2.0
2.09k stars 219 forks source link

[BUG] Query is not working is not encoded #1073

Open darkmatter18 opened 5 days ago

darkmatter18 commented 5 days ago

Describe the bug If the query values are not in proper Python type, the query is not working. But the typed variable is working.

To Reproduce

await Model.find_many({'tenant': {'$in': ['f6a0e5a3-ef1c-414d-8c34-61a9c2d1828a']}})
# This is giving a None response

Expected behavior

await Model.find_many({'tenant': {'$in': [UUID('f6a0e5a3-ef1c-414d-8c34-61a9c2d1828a')]}})
# This is giving a None response           ^^^^^

In mongoengine, this was giving me proper response,

await Model.objects.find(tenant__in=['f6a0e5a3-ef1c-414d-8c34-61a9c2d1828a')])

So the expectation is to work on this query {'tenant': {'$in': ['f6a0e5a3-ef1c-414d-8c34-61a9c2d1828a']}}

adeelsohailahmed commented 2 days ago

Could you please share your model definition and, ideally, a minimal reproducible example?