redis-om-python
redis-om-python copied to clipboard
Bool Field in Model combined with List[str] Field seems to break Model.find().all() after List update
To reproduce:
class Base:
class Meta:
database = redis
class Entity(Base, JsonModel):
name: str = Field(index=True)
some_list: List[str] = Field(index=True, default=[])
random_bool_field: bool = Field(index=True, default=0)
Migrator().run()
for i in range(100):
entity = Entity(name=f"Entity{i}")
entity.save()
entities = Entity.find().all()
assert len(entities) == 100 # <- OK
for i in range(100):
entity = Entity.find(Entity.name == f"Entity{i}").first()
entity.some_list.append("test")
entity.save()
entities = Entity.find().all()
assert len(entities) == 100 # <- AssertionError!
The code works when the bool field is defined without the Field syntax, like random_bool_field: bool = 0
but then I cannot index it.
It also works when I update an integer field instead of the list append.
Checking this out! What a good/weird bug find!
Should be resolved by #611