Hi, I just tried and yes, inheriting from class V, you can get all classes City, in the documents model just like in the graphs using the query: Select expand ($ c) Let $ a = (select expand from v), $ B = (select from City), $ C = unionAll ($ a, $ b)
El jueves, 10 de noviembre de 2016, 9:13:39 (UTC+1), Academia Learning Centro de inglés y de formación escribió: > > OK thanks. One last question, in the document model, can also be inherited > from class V? > If so then it would be easier to find the city class, right? With the > query of the previous example: > Select expand (City) from v > > Or in the document model this is not possible? > > Thank you! > > El miércoles, 9 de noviembre de 2016, 16:56:00 (UTC+1), > [email protected] escribió: >> >> Hi, >> you could use this javascript function >> >> var db=orient.getDatabase(); >> var classes=db.query('select name from (select expand(classes) from >> metadata:schema) where name not in >> ["_studio","OUser","OSchedule","E","V","OFunction","OIdentity","OTriggered","ORole","ORestricted","OSequence"]' >> ); >> >> var result=[]; >> >> for (var i = 0; i < classes.length; i++) { >> var className = classes[i].field('name'); >> if(className=="City"){ >> var cities=db.query("select from " + className); >> for (var j = 0; j < cities.length; j++) { >> result.push(cities[j]); >> } >> } >> else{ >> var cities=db.query("select expand(City) from " + className); >> for (var j = 0; j < cities.length; j++) { >> result.push(cities[j]); >> } >> } >> } >> return result; >> >> Hope it helps. >> >> -- --- You received this message because you are subscribed to the Google Groups "OrientDB" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
