orientdborientjs

OrientDB: How to flatten nested heirarchy into a single record


I have a structure that looks something like this:

enter image description here

How can I traverse my Page and get back a flat record so that each row represents all of data from the root node and its edges. My use case is that I'm producing a csv file.

so from the example above, i would like to create a row for each post. Each record should contain all fields from post, the language name, the page name, and the network name.

From what I can tell, when you do any kind of traversal, it only gives you the result of the final vertex and not any data from the vertices in between.


Solution

  • Try this query:

    select *,out('posted_to').name as page,out('posted_to').out('is_language').name as language,out('posted_to').out('is_network').name as network from <class Post> unwind page,language,network