Skip to content

Traversals and ordering example of official documentation seems not to work #884

@christianholland

Description

@christianholland

Expected Behavior (Mandatory)

Based on the Traversals and ordering chapter we expect to be able to order based on a relationship property

Actual Behavior (Mandatory)

from neomodel import  StructuredNode, StructuredRel, DateTimeProperty, StringProperty, IntegerProperty, RelationshipFrom
from datetime import datetime

class SupplierRel(StructuredRel):
    since = DateTimeProperty(default=datetime.now)


class Supplier(StructuredNode):
    name = StringProperty()
    delivery_cost = IntegerProperty()


class Coffee(StructuredNode):
    name = StringProperty(unique_index=True)
    price = IntegerProperty()
    suppliers = RelationshipFrom(Supplier, 'SUPPLIES', model=SupplierRel)

r = Coffee.nodes.order_by(
    '-suppliers__delivery_cost',
    'suppliers|since',
)
r.all()

# no  sorting
query:  MATCH (coffee:Coffee) RETURN coffee
params: {}
took: 0.053s

Currently used versions

Versions

  • OS: Linux
  • Library: 5.5.0
  • Neo4j: 5.25.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationIssues requiring modifications to the documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions