Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
10-24-2018 12:54 PM
So I have a neo4j database to store a forum-like data structure.. posts, replies, reactions.. etc.
I'm trying to get a single Post details with all replies, reactions and related users.. so I'm doing this:
_graphClient.Cypher
.Match("(u:User)-[r]->(q:Question)")
.Where<Post>(q => q.Uid == questionId)
.Return((u, r, q) => new
{
questionPost = q.As<Post>(),
involvedUsers = u.CollectAsDistinct<UserModel>(),
relations = r.CollectAs<string>()
}).ResultsAsync;
I have a problem in this line relations = r.CollectAs<string>()
.. I have already a Reply
class and a PostReaction
class.. but how to get them dynamically?
Is the model I'm using is wrong? Should I specify the relationship type and do multiple queries?
10-24-2018 01:54 PM
Can you return type(r)
instead of r
? If you only need the type of the relationship that should work.
All the sessions of the conference are now available online