You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
class Port(Document):
...
portFilter: Optional[PortFilter]`
I tried to use an update query to create a new PortFilter and set port.portFilter reference like this: port_filter = await PortFilter().create()
await Port.find(...).update(Set({Port.portFilter: port_filter}))
But it throws the following exception: "cannot encode object: PortFilter(id=ObjectId('63b93e38e294883bae6ad9f2'), linkAllowed=True, nameRegexp=None), of type: <class 'PortFilter'>
I can update other fields which are not references to other Documents.
Is there anyway around this or is it a limitation in Beanie?
Note that support for relations using Link was introduced after I started using Beanie and I have not had time to try it out yet.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have two Document objects defined like this:
`class PortFilter(Document):
linkAllowed: bool = True
nameRegexp: Optional[str]
class Port(Document):
...
portFilter: Optional[PortFilter]`
I tried to use an update query to create a new PortFilter and set port.portFilter reference like this:
port_filter = await PortFilter().create()
await Port.find(...).update(Set({Port.portFilter: port_filter}))
But it throws the following exception:
"cannot encode object: PortFilter(id=ObjectId('63b93e38e294883bae6ad9f2'), linkAllowed=True, nameRegexp=None), of type: <class 'PortFilter'>
I can update other fields which are not references to other Documents.
Is there anyway around this or is it a limitation in Beanie?
Note that support for relations using Link was introduced after I started using Beanie and I have not had time to try it out yet.
Beta Was this translation helpful? Give feedback.
All reactions