redis-om-python
redis-om-python copied to clipboard
Find by optional field returns documents with None
trafficstars
Hi! I have model with Optional[int] indexed field and I want to query via that field. In results I see documents with None in that field. Why? How to avoid it?
class Page(JsonModel):
id: int = Field(index=True)
base_id: Optional[int] = Field(index=True)
Migrator().run()
pages = Page.find(Page.base_id == 1).all()
In results I see docs with base_id = None
Thanks for bringing this up! Seems like right now the easiest way to get around this is to add a default value that would never exist in your data. I'll take a look through the source code and see what's going on!
Has it already been fixed? Can't reproduce it
redis-om = "^0.1.2"
@DennyD17 - I agree, can't reproduce on my end, will close, if this recurs feel free to reopen.