Skip to content

Instantly share code, notes, and snippets.

View yojimbo87's full-sized avatar

Tomas Bosak yojimbo87

View GitHub Profile
@yojimbo87
yojimbo87 / gist:4188295
Created December 2, 2012 11:30
Arango queries test
// get all event titles with companies count based on user hash
LET uid = (
FOR u IN Users
FILTER u.Hash == "jb"
RETURN u._id
)
FOR e IN Events
FILTER e.OwnerID == uid[0]
RETURN { "Event": e.Title, "Companies": LENGTH(e.Companies) }
@yojimbo87
yojimbo87 / gist:5468805
Last active December 16, 2015 17:10
OrientDB select flatten test
orientdb> select from eventprofile
----+-----+----+-------+----+-----
# |@RID |out_|EventID|Type|in_
----+-----+----+-------+----+-----
0 |#12:0|[3] |#11:0 |Job |#11:0
----+-----+----+-------+----+-----
1 item(s) found. Query executed in 0.024 sec(s).
@yojimbo87
yojimbo87 / gist:5468940
Created April 26, 2013 17:37
OrientDB construct custom nested/embedded object inside select projection
orientdb> select map('name1', out[0].in.name, 'name2', out[1].in.name), name from person
---+---------+--------------------+--------------------
#| RID |map |name
---+---------+--------------------+--------------------
0| #-2:1|{name1=julia, name2=mary}|george
---+---------+--------------------+--------------------
1 item(s) found. Query executed in 0.04 sec(s).
orientdb> gremlin g.v('#11:0')
Event#11:0{out_has_company:[3],ID:1,EventProfileID:null,Title:Event 1,Companies:null,out_has_ep:#12:0} v4
Script executed in 0.053000 sec(s).
orientdb> gremlin g.v('#11:0').out()
[Company#15:0{out_has_kiosk:[3],out_has_exhibitor:[3],ID:null,Title:Company 1,Exhibitors:null,Kiosks:null,in_has_company:#11:0} v7, Company#15:1{in_has_company:
[2],ID:null,Title:Company 2,Exhibitors:null,Kiosks:null,out_has_exhibitor:#14:3,out_has_kiosk:#16:3} v4, Company#15:1{in_has_company:[2],ID:null,Title:Company 2
,Exhibitors:null,Kiosks:null,out_has_exhibitor:#14:3,out_has_kiosk:#16:3} v4, EventProfile#12:0{out_has_pi:[3],ID:null,EventID:#11:0,Type:Job,ProfileItems:null,
ArangoDB (1.4.7)
Written in: C/C++
Main point: Multi-model flexible database for documents, graphs and key-values
License: Apache 2
Protocol: HTTP/REST
Master/slave replication
Querying support through declarative query language AQL based on JSONiq and XQuery
Extensible through JavaScript or built-in single page application framework Foxx