Accessing graph return variables in Server Side Scripts

28 views
Skip to first unread message

Khaled B

unread,
Feb 17, 2015, 5:15:54 AM2/17/15
to orient-...@googlegroups.com
Hello,

I'm trying the following javascript server side function. I want to access the returned user IDs :

  var gdb = orient.getGraph();
  var friends= gdb.command( "sql", "select userid from (select expand(out(\"Friend\")) from User where userid= 1)" );
  var  first_friend= friends[0]; // friends is definitely not empty
  return first_friend['userid']; // incorrect return. also tried first_friend.field("userid") and  first_friend.userid

If just returning first_friend:
[
    {
        "@type": "d",
        "@rid": "#-2:0",
        "@version": 0,
        "userid": 21
    }
]

Thank you for the help in advance.


Khaled B

unread,
Feb 18, 2015, 6:45:50 AM2/18/15
to orient-...@googlegroups.com
anyone?  
Reply all
Reply to author
Forward
0 new messages