Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nodeset.get returns a list when adding a relationship filter kwarg #856

Open
FerrielMelarpis opened this issue Jan 22, 2025 · 0 comments
Open

Comments

@FerrielMelarpis
Copy link

Not sure if it is really a bug or I just can't find the documentation for this behavior so please feel free to point me to the right direction 🙏🏼

Expected Behavior (Mandatory)

Nodeset.get returns the matching StructuredNode.

Actual Behavior (Mandatory)

Nodeset.get returns a list containing the matched StructuredNode and the associated StructuredRel.

How to Reproduce the Problem

Create a two node class and one relationship class to connect the two.

Simple Example

class TemporaryRelationship(StructuredRel):
  from_date = DateTimeProperty(default_now=True)
  to_date = DateTimeProperty()

class Person(StructuredNode):
  __label__ = "Person"
  uid = UniqueIdProperty()
  name = StringProperty(required=True)
  created_at = DateTimeProperty(default_now=True)
  updated_at = DateTimeProperty(default_now=True)
  member_of = RelationshipTo("Team", "MEMBER_OF", model=TemporaryRelationship)

class Team(StructuredNode):
  __label__ = "Team"
  uid = UniqueIdProperty()
  name = StringProperty(required=True)
  created_at = DateTimeProperty(default_now=True)
  updated_at = DateTimeProperty(default_now=True)
  members = RelationshipFrom("Person", "MEMBER_OF", model=TemporaryRelationship)

p = Person(name="Akira")
p.save()
t = Team(name="Engineering")
t.save()
p.connect(t)

# p -> member_of -> t
result = Person.nodes.get(uid=p.uid, member_of__uid=t.uid) 
# result = list(<Person(name="Akira" ...)>, <TemporaryRelationship ...>)

Datasets and Statements

Screenshots (where it's possibile)

N/A

Specifications (Mandatory)

Currently used versions

Versions

  • OS: macos sequioa 15.2
  • Library: neomodel 5.4.2
  • Neo4j: latest (DB is hosted in Aura)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant