Open
Description
I have a model like this:
class City(JsonModel):
country_id: str = Field(index=True)
region_id: str | None = Field(index=True)
How do I query for a city in a specific country that is not associated with any region? I.e.: a capital or a large city like Bremen in Germany?
The following queries do not work and raise errors:
cities = City.find((City.country_id == "de") & (City.region_id is None)).all()
aioredis_om.model.model.QuerySyntaxError: Counld not resolve field name. See docs: TODO
cities = City.find((City.country_id == "de") & (City.region_id == None)).all()
TypeError: argument of type 'NoneType' is not iterable
I failed to find any reference in the docs about scenarios like that... 🤔
P.S.: SQLAlchemy has .filter(City.region_id == None)
or .filter(City.region_id.is_not(None))
to handle those cases.
Metadata
Metadata
Assignees
Labels
No labels