Since a couple of years, the NoSQL movement has developed a variety of open-source document stores. They are focused on high availability, horizontal scalability, and are designed to run on commodity hardware. These products have gained great traction in the industry to store large amounts of flexible data. Arguably, the next step for the NoSQL community is on harnessing flexible data processing.
The aim of this presentation is to introduce JSONiq: the SQL of NoSQL.
16. NoSQL Checklist 28
Document Stores
High Availability ✔
Sharding ✔
Available as a Service ✔
Standardized Query Language X
Modern Query Processing X
17. NoSQL Checklist 28
Document Stores
High Availability ✔
Sharding ✔
Available as a Service ✔
Standardized Query Language X
Modern Query Processing X
Rich Data Model
20. NoSQL Checklist 28
Document Stores
High Availability ✔
Sharding ✔
Available as a Service ✔
Standardized Query Language X
Modern Query Processing X
Rich Data Model X
21. NoSQL Checklist 28
Document Stores
High Availability ✔
Scalability
Sharding ✔
Available as a Service ✔
Standardized Query Language X
Flexible Data
Modern Query Processing X
Rich Data Model X
23. JSONiq (1) 28
Declarative JSON Query Language
Fully Composable
Extension of XQuery, a mature W3C standard,
with native JSON support
Contributors: 28msec, Oracle, EMC
24. JSONiq (2) 28
Updates, Indexes, Search, Transform &
Filter, Join, Group, and more
Open Source Implementation: Zorba
Drivers: MongoDB, CouchDB, AmazonDB,
SQLite, Oracle NoSQL
25. {
"question_id" : 42,
"title" : "NoSQL: Help me to choose",
"tags" : [ "mongodb", "couchdb" ],
"answered" : true,
}
26. let $question :=
{
"question_id" : 42,
"title" : "NoSQL: Help me to choose",
"tags" : [ "mongodb", "couchdb" ],
"answered" : true,
}
return $question("title")
27. for $answers in mongo:find("answers")
group by $id := $answers("question_id")
order by count($answers) descending
let $faq := mongo:find("faq")
return
<h1>{
$faq[.("id") eq $id]("title")
}</h1>
<h1>NoSQL: Help me to Choose</h1>
<h1>What NoSQL solutions for .NET?</h1>
<h1>The Next-gen Databases</h1>
...
28. for $question in mongo:find("faq")
let $user := $question("owner")
group by $user := $user("user_id")
return {
"user" : $user[last()]("display_name"),
"count" : count($question)
}
{ "user": "jbellis", "count": 6 }
{ "user": "user1557698", "count": 5 }
{ "user": "nawroth", "count": 5 }
...
29. max(
for tumbling window $answers
in mongo:find("answers")
start $start when true
only end $end next $next
when $next("date") - $end("date") gt
xs:dayTimeDuration("P1D")
return $end("date") - $start("date")
)
{ "user": "jbellis", "streak": 2 }
{ "user": "user1557698", "streak": 1 }
{ "user": "nawroth", "streak": 1 }
...
30. "Luke, I am your father"
contains text "dad"
false
31. "Luke, I am your father"
contains text "dad"
using thesaurus default
true
32. let $s := "These are not the droids you
are looking for"
let $tokens := ft:tokenize-string($s)
for $token in $tokens
where not(ft:is-stop-word($token))
return ft:stem($token)
droid look
...
37. Take Away 28
• JSONiq.org - The SQL of NoSQL
• Open Source Implementation: Zorba
• Next Stop: Automatic Index Detection
Query Parallelization
• Hosting: 28.io
• Demo: http://28.io/mongodb