Open ziqizhang opened 2 months ago
I will look into the "no search" error.
For accessing relationship properties, you need the all_relationships()
method, like so:
async def test_retrieve_all_rels():
tom = await Badger(name="tom").save()
ian = await Stoat(name="ian").save()
rel_a = await tom.hates.connect(ian, {"reason": "a"})
rel_b = await tom.hates.connect(ian, {"reason": "b"})
rels = await tom.hates.all_relationships(ian)
print(rels[0].reason)
Expected Behavior (Mandatory)
As per https://neomodel.readthedocs.io/en/latest/getting_started.html#retrieving-additional-relations, you can search on relations using, e.g.,
germany.inhabitant.search(name='Jim')
Actual Behavior (Mandatory)
This no longer works with the library as it gives error:
AttributeError: 'ZeroOrMore' object has no attribute 'search'
How to Reproduce the Problem
Run the code below.
Simple Example
Screenshots (where it's possibile)
Specifications (Mandatory)
Run the above code, line B will generate the error reported above.
Also, there is no documentation on how to get properties of a custom relationship. Line A would not work as
jim.moved_to
Returns a ZeroOrMove object, not a relation object. Calling
all()
on that object will traverse the relationship to get 'Country' objects, not the relation itself.Versions