I was doing some tests on a query I've got and noticed something that 
seemed odd, or maybe I'm doing something wrong and completely missed the 
point of function first();

I went into  2.0 RC1 and RC2 on Linux and made a few tests, and whenever I 
use the  first()  function on a query the results that I get back are just 
1 record long. 

I though that first() work simply operate on a set and return the first 
item of a set , like for example :    first( ["AAA","BBB", "CCC"] )  would 
return  "AAA"  for that particular record in a result that has many other 
records. 

Example :

select
 itemid,
 out("somethingelse").description 
from (
  select expand(in("something")) 
  from Company where something="blah"
  limit -1
) 
limit -1


With this query I get a multi record result, where the 
 out("somethingelse").description   is a  set of items that always have 
just one item,  like  ["AAA"] . 

Since I dont want an array to be returned , specially since it will always 
be 1 item long I wrote the next query  : 

select
 itemid,
 first( out("somethingelse").description )
from (
  select expand(in("something")) 
  from Company where something="blah"
  limit -1
) 
limit -1


With it I now get :

   - a resultset of 1 record long, which is clearly something I dont want, 
   I want all the results I was getting before  
   - first( out("somethingelse")) returning now  "AAA" i, which I want
   

Maybe I'm seeing this all wrong and first()  function makes the result set 
be always just one record long , the first one ,  but I though that first() 
 only operated on the set provided as an argument,

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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to