Search code examples
orientdbdocumentdatabasenosql

Reconstructing Document in OrientDB


I am attempting to make a database to keep a simple menu of items for my favorite restaurants. I have a class for establishments, a class for different menus (like happy hour/dinner/lunch/etc.) and a class for individual items on the menus. Each establishment class has a set of menus and each menu has a set of items.

Is there a single command to reconstruct an entire restaurants menu into a single document?

I'm guessing it has something to do with functions. I have tried messing around with unwind, expand, out, and traverse but I can't seem to figure it out.


Solution

  • Have you tried "fetch plans" in Orientdb. https://orientdb.com/docs/last/Fetching-Strategies.html

    Giving -1 as the depth level will go through the links unlimited and load all the documents to a single doc.

    In your case the fetch plan would be something like this.

    "select from Establishment fetchPlan *:-1"