I'm working on a Rails application that tracks transactions between addresses, using Neo4j as the database. When I try to run this query:
Neo4j::Session.query("MATCH (sender:Address {address: 'abc123'})-[transaction:SENT_TO]->(receiver:Address) RETURN sender, transaction, receiver").to_a
I get back an array, as expected, but the transaction
item returns as a CypherRelationship pointer rather than a struct of its properties like it does for the sender and receiver addresses:
=> [#<struct sender=#<Address uuid: nil, address: "abc123", user_tags: nil>, transaction=CypherRelationship 30, receiver=#<Address uuid: nil, address: "xyz321", user_tags: nil>>]
If I try to get one of the transaction properties by doing something like transaction.props['amount']
it causes a new Cypher query to run. Since there are multiple properties I want to get back on each transaction, and a large number of transactions that will be returned, I would like for the initial query to simply return the properties of the relationship as a struct within the array.
This works how I want it to when I run the query directly in Neo4j, so I suspect it's an issue with the neo4j-core gem (or my use of it)... any ideas?
Thanks for your help!