It works! Thanks 
 

On Friday, 24 October 2014 08:52:59 UTC+11, Lvc@ wrote:
>
> Hi,
> employees contains ODocument objects, so to extract fields you should use 
> .field() method. To get the identity ODocument has .getIdentity() method. 
> Example:
>
>     var e = "create edge employee_belong_dpartement from #" + 
> emp.getIdentity() + " to " +  department.getIdentity();
>
>
> Lvc@
>
>
> On 23 October 2014 16:46, Brett Coffin <[email protected] <javascript:>> 
> wrote:
>
>> I am trying to generate some mock data via a function, basically some 
>> edges between a "Department" and "Employee" Vertex.
>>
>> Here is the code:
>>
>> var employees = gdb.command('sql', 'select * from Employee', []);
>> var departments = gdb.command('sql', 'select * from Department', []);
>>
>> for (var i = 0; i < employees.length; i++) {
>>     var emp = employees[i];
>>     var department = 
>> departements[Math.round(Math.random()*(departements.length - 1))];
>>     var e = "create edge employee_belong_dpartement from #" + emp['@rid'] 
>> + " to " +  department['@rid'];
>>     gdb.command('sql',e, []);
>> }
>>
>> gdb.commit();
>>
>> Could someone explain me why I can't get this to work ?
>>
>> When I log  emp['@rid'] I get nothing back, I can't seem to read the 
>> "id" or any other value.
>> Please help me understand what is going on in the console as its hard to 
>> debug thanks
>>
>>  
>>
>> -- 
>>
>> --- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 

--- 
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.

Reply via email to