Describe the bug
BackLinks results in a value error when keep_nulls is set to False. Specifically fails at this line of code: return {key: self.encode(value) for key, value in obj.items()}.
To Reproduce
class House(Document, extra="allow"):
name: str
door: Link["Door"]
class Settings:
name = "house"
keep_nulls = False
class Door(Document, extra="allow"):
height: int = 2
width: Optional[int] = None
house: BackLink[House] = Field(original_field="door")
class Settings:
name = "Door"
keep_nulls=False
async def init():
client = get_beanie_client()
await init_beanie(database=client.test_beanie, document_models=[House,Door])
house = House(name = "NEW NAME1", door = Door())
await house.insert(link_rule=WriteRules.WRITE)
Expected behavior
No error thrown.
Additional context
Setting keep_nulls to True does not result in an error.
Describe the bug BackLinks results in a value error when keep_nulls is set to False. Specifically fails at this line of code:
return {key: self.encode(value) for key, value in obj.items()}
.To Reproduce
Expected behavior No error thrown.
Additional context Setting keep_nulls to True does not result in an error.