Hi all,
in "develop" branch I've just committed a new powerful feature: allow to
filter collections in chain. To understand it let's go to a couple of
examples.

*Examples*

*Example 1: Get the first friend of mine*

You can get it by using:

select expand( out ) from (
  select out('Friend') from Profile where name = 'Luca'
) limit 1

But now you can also do this:

select out('Friend')*[0]* from Profile where name = 'Luca'

Much easier and faster on execution!

*Example 2: from GratefulDeadConcerts database traverse all the out()
connection and get the first song called 'MONA'*

select from (
  select expand( out() ) from V
) where name = 'MONA' and type = 'song' limit 1

 @rid @version @class name in_followed_by song_type performances
typeout_followed_byout_sung_byout_written_by
#9:6<http://localhost:2480/studio/index.html#/database/GratefulDeadConcerts/browse/edit/9:6>19VMONA[2]cover1song[2][1][1]
Executed in 0.455 seconds.

Now let's use the new way:

select expand( out()*[name='MONA'][type='song']* ) from V

 @rid @version @class name in_followed_by song_type performances
typeout_followed_byout_sung_byout_written_by
#9:6<http://localhost:2480/studio/index.html#/database/GratefulDeadConcerts/browse/edit/9:6>19VMONA[2]cover1song[2][1][1]
Executed in 0.106 seconds.

Note last execution, in this case, is 4x faster!

Squared brackets [] allows:
- filtering by one index, example out()[0]
- filtering by multiple indexes, example out()[0,2,4]
- filtering by ranges, example out()[0-9]
- filtering by equal conditions (only equals is supported), example
out()[@class = 'Person']

Brackets [] can be chained, in this case it's like filtering by AND
operator. Look at the Example 2.

For more information about the issue:
https://github.com/orientechnologies/orientdb/issues/1888


Luca Garulli
CEO at Orient Technologies
the Company behind OrientDB
http://about.me/luca.garulli

-- 

--- 
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/groups/opt_out.

Reply via email to