select @this.toJSON('fetchPlan:roles:1') from OUser where name='admin'{
"result": [
{
"@type": "d",
"@rid": "#-2:1",
"@version": 0,
"this": "{\"name\":\"admin\",\"password\":\"{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918\",\"status\":\"ACTIVE\",\"roles\":[{\"name\":\"admin\",\"inheritedRole\":null,\"mode\":1,\"rules\":{\"database.bypassrestricted\":15}}]}"
}
],
"notification": "Query executed in 0.057 sec. Returned 1 record(s)"
}{ "@type": "d", "@rid": "#-2:1", "@version": 0, "rid": "#5:0",select expand(roles) from OUser where name='admin'
--
---
You received this message because you are subscribed to a topic in the Google Groups "OrientDB" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orient-database/QPhLb5MJI6s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orient-databa...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
{ "@type": "d", "@rid": "#4:0", "@version": 2, "@class": "ORole", "name": "admin", "inheritedRole": null, "mode": 1, "rules": { "database.bypassrestricted": 15 }, "@fieldTypes": "mode=b" }select @this.toJSON('rid,fetchPlan:roles:1') from OUser where name='admin'
{ "@type": "d", "@rid": "#-2:1", "@version": 0, "this": "{\"@rid\":\"#5:0\",\"name\":\"admin\",\"password\":\"{SHA-256}8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918\",\"status\":\"ACTIVE\",\"roles\":[{\"@rid\":\"#4:0\",\"name\":\"admin\",\"inheritedRole\":null,\"mode\":1,\"rules\":{\"database.bypassrestricted\":15}}]}" }Hey Jonathan,I appreciate the effort but I'm afraid that query only returns the roles (linked records) and not the user (parent record), result below. The objective is to get the parent and the linked records with the latter having their @rid included. My original query, select @this.toJSON('fetchPlan:roles:1') from OUser where name='admin', is very close to it but the linked records come without @rid. Let me know if this is not clear. I'm also trying to avoid running more than one query for performance reasons.
{"@type": "d","@rid": "#4:0","@version": 2,"@class": "ORole",
"name": "admin","inheritedRole": null,"mode": 1,"rules": {"database.bypassrestricted": 15},
"@fieldTypes": "mode=b"}
On Monday, 10 November 2014 21:28:29 UTC, Jonathan Rosen wrote: