Skip to content

Discord Data Cypher Queries

Example Queries



MATCH (channelNode:Channels)<-[:message_channel]-(messageNode:Messages) return messageNode, channelNode

MATCH (guildNode:Guilds)<-[:guild_channel]-(channelNode:Channels)<-[:message_channel]-(messageNode:Messages) return guildNode, messageNode, channelNode


MATCH (guildNode:Guilds)<-[:guild_channel]-(channelNode:Channels)<-[:message_channel]-(messageNode:Messages)-[:message_author_id]->(authorNode:Authors) return guildNode, messageNode, channelNode, authorNode

Get all Authors that have posted in the same channel




List Authors, Guilds, and Channels


MATCH (startNode:Authors)-[:author_guild]->(midNode:Guilds)<-[:guild_channel]-(endNode:Channels)
RETURN startNode, midNode, endNode LIMIT 25

What messages reply to one another


MATCH (reply:Messages) - [:reply_to_message] -> (op:Messages) return reply, op

Authors who reply to one another via Messages


MATCH (a:Authors) <- [:message_author_id] - (b:Messages) - [:reply_to_message] -> (c:Messages) - [:message_author_id] -> (d:Authors) return a, b, c, d limit 300

Messages and Author and how they connect


MATCH p=()-[r:message_author_id]->() RETURN p LIMIT 100

MATCH (reply_author:Authors) <- [:message_author_id] - (reply:Messages) - [:reply_to_message] -> (op:Messages) return reply_author, reply, op

  • The following query is invalid because the reply_author is already linked
MATCH (reply_author:Authors) <- [:message_author_id] - (reply:Messages) - [:reply_to_message] -> (op:Messages) - [:message_author_id] -> (op_author:Messages)  return reply_author, reply, op, op_author

What reactions do author messages have in common?