SlideShare a Scribd company logo
ArangoDB

/* Using Javascript
   in the database */

 Jan Steemann, triAGENS, Cologne
ArangoDB
  basics



www.arangodb.org © j.steemann@triagens.de
ArangoDB.explain()

{
    "type":             "NoSQL database",
    "openSource": true,
    "version":          1.0,
    "builtWith": [ "C", "C++", "js" ],
    "Javascript": [ "client side",
                "server side" ],
    "uses":             [ "V8" ]
}

                  www.arangodb.org © j.steemann@triagens.de
Documents
      and collections
ArangoDB is a database that works with
documents

Documents are sets of name / value pairs
(think of JSON objects), e.g.

{ "name": "Jan", "age": 37 }

Documents are organised in collections (like
tables in relational databases)

           www.arangodb.org © j.steemann@triagens.de
Data types: JSON!

ArangoDB operates on JSON documents

JSON data can be saved as-is:

db.users.save({
  "name": "Jan",
  "uses": [ "vi", "js", "C++" ]
});


            www.arangodb.org © j.steemann@triagens.de
Schema-free
Documents can be heterogenous –
even in the same collection, e.g.

{ "name": "Jan", "age": 37 },
{ "name": "Tim", "likes": [ "js" ] },
{ "name": {
    "first": "Patrick",
    "last": "Star"
  }
}

No need to care about schemas
              www.arangodb.org © j.steemann@triagens.de
API & protocols
ArangoDB server functionality is exposed via an
HTTP REST API

ArangoDB answers HTTP queries,
so it can be used from the browser

Simple to use from Javascript clients

(3rd party) drivers available for node.js, Ruby,
PHP, ...

Javascript-enabled client shell provided

           www.arangodb.org © j.steemann@triagens.de
Querying



www.arangodb.org © j.steemann@triagens.de
Querying is simple

Query a document by its unique id / key:
db._document("users/9558905");

Query by providing an example:
db.users.byExample({
  "name": "Jan",
  "age": 37
});



          www.arangodb.org © j.steemann@triagens.de
Indexes
ArangoDB allows querying on any document
attributes or sub-attributes

Secondary indexes can be created for higher
query performance:
•   Hash indexes (equality queries)
•   Skiplists (range queries)
•   2d geo indexes (location queries)

            www.arangodb.org © j.steemann@triagens.de
Geo index examples


// get b a r n ea r es t t o coor d in a t e
db.bars.near(48.51, 2.21).limit(1);

// get a ll s h op s w it h in r a d iu s
// a r ou n d coor d in a t e
db.shops.within(48.51, 2.21, rad);



               www.arangodb.org © j.steemann@triagens.de
References
ArangoDB can store references between
documents

References are documents with two endpoints
(the documents they connect)

Reference documents can carry own attributes




          www.arangodb.org © j.steemann@triagens.de
References example
Users documents:                                     Relations documents:
                                                     (references)
{
    "name": "Jan",
    "age": 37                                        {
}                                                        "_from": "users/jan",
                                                         "_to": "users/tim",
{                                                        "type": "knows",
    "name": "Tim",                                   }
    "city": "Paris"
}

// q u er y ou t b ou n d r ela t ion s f r om "J a n "
db.relations.outEdges(jan); // => tim
                      www.arangodb.org © j.steemann@triagens.de
Graph queries

References make it possible to process graphs
with ArangoDB

Some special functions are provided to
determine paths in a graph etc.

Can write own Javascript functions for special
traversals


          www.arangodb.org © j.steemann@triagens.de
Query language

ArangoDB can also answer complex
SQL-like queries

Such queries are expressed in ArangoDB's
textual query language

This language allows joins, sub-queries,
aggregation etc.


          www.arangodb.org © j.steemann@triagens.de
Example query
FOR u IN users                                             It er a t or
 FILTER u.addr.country == "US" &&
       (u.isConfirmed == true ||
        u.age >= 18)                                          F ilt er
 LET userLogins = (
   FOR l IN logins
     FILTER l.userId == u.id
     RETURN l
 )                                                       S u b q u er y
 RETURN {
   "user":     u,
   "logins": LENGTH(userLogins)
 }                                                           R es u lt
             www.arangodb.org © j.steemann@triagens.de
Server side „actions“



     www.arangodb.org © j.steemann@triagens.de
Application server

ArangoDB can answer web requests directly

This also makes it an application server

Users can extend its functionality with server
side Javascript „actions“

Actions are user-defined functions that contain
custom business logic


           www.arangodb.org © j.steemann@triagens.de
Actions


Actions are bound to URLs and executed when
URLs are called, e.g.

/users?name=... => function(...)
/users/.../friends => function(...)




           www.arangodb.org © j.steemann@triagens.de
Actions example
function (req, res) {
  // get r eq u es t ed u s er f r om d b ,
  // n a m e is r ea d f r om U R L p a r a m et er
 var u = db.users.byExample({
   "username": req.urlParameters.name
 });

    // r em ov e p a s s w or d h a s h
    delete u.hashedPassword;

    // b ef or e r et u r n in g t o ca ller
    actions.resultOk(req, res, 200, u);
}
                    www.arangodb.org © j.steemann@triagens.de
Actions – Use cases
Filter out sensitive data before responding

Validate input

Check privileges

Check and enforce constraints

Aggregate data from multiple queries into a single
response

Carry out data-intensive operations

           www.arangodb.org © j.steemann@triagens.de
Summary



www.arangodb.org © j.steemann@triagens.de
ArangoDB - summary
Flexible in terms of data modelling and querying

API is based on web standards:
HTTP, REST, JSON

Easy to use from Javascript clients

Can be used as application server

Functionality can be extended with server side
Javascript „actions“

          www.arangodb.org © j.steemann@triagens.de
Thanks!
          Any questions?
Спасибо                                                      Grazie

Teşekkürler                                                ¡Gracias!

Merci!                                                       Хвала

Dank je wel                                               Ευχαριστώ

ありがとう                                                        고마워

Tack så mycket                                               Danke

              www.arangodb.org © j.steemann@triagens.de
Give it a try!
ArangoDB source repository:
https://www.github.com/triAGENS/ArangoDB
(use master branch)

Website: http://www.arangodb.org/

Builds available for Homebrew and
several Linux distributions

Twitter: #arangodb, @arangodb

Google group: ArangoDB
           www.arangodb.org © j.steemann@triagens.de
Roadmap


MVCC / ACID transactions

Triggers

Synchronous and asynchronous replication




           www.arangodb.org © j.steemann@triagens.de
Thank you!
Stay in Touch:
 •   Fork me on github
 •   Google Group: ArangoDB
 •   Twitter: @steemann & @arangodb
 •   www.arangodb.org



                 www.arangodb.org © j.steemann@triagens.de
Ad

Recommended

Hotcode 2013: Javascript in a database (Part 1)
Hotcode 2013: Javascript in a database (Part 1)
ArangoDB Database
 
Rupy2012 ArangoDB Workshop Part1
Rupy2012 ArangoDB Workshop Part1
ArangoDB Database
 
Using MRuby in a database
Using MRuby in a database
ArangoDB Database
 
Hotcode 2013: Javascript in a database (Part 2)
Hotcode 2013: Javascript in a database (Part 2)
ArangoDB Database
 
Running MRuby in a Database - ArangoDB - RuPy 2012
Running MRuby in a Database - ArangoDB - RuPy 2012
ArangoDB Database
 
Is multi-model the future of NoSQL?
Is multi-model the future of NoSQL?
Max Neunhöffer
 
Introduction to ArangoDB (nosql matters Barcelona 2012)
Introduction to ArangoDB (nosql matters Barcelona 2012)
ArangoDB Database
 
Arango DB
Arango DB
NexThoughts Technologies
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
ArangoDB Database
 
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
ArangoDB Database
 
OrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data Relationships
Fabrizio Fortino
 
OrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KW
gmccarvell
 
Connecting to a REST API in iOS
Connecting to a REST API in iOS
gillygize
 
Graph Databases & OrientDB
Graph Databases & OrientDB
Arpit Poladia
 
Small Overview of Skype Database Tools
Small Overview of Skype Database Tools
elliando dias
 
Solid pods and the future of the spatial web
Solid pods and the future of the spatial web
Kurt Cagle
 
Using Webservice in iOS
Using Webservice in iOS
Mahboob Nur
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsing
Jussi Pohjolainen
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
Mubashar Iqbal
 
Introduction to column oriented databases
Introduction to column oriented databases
ArangoDB Database
 
State of the Semantic Web
State of the Semantic Web
Ivan Herman
 
RDFa Tutorial
RDFa Tutorial
Ivan Herman
 
elasticsearch basics workshop
elasticsearch basics workshop
Mathieu Elie
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
Marco Gralike
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQL
Luca Garulli
 
The Lonesome LOD Cloud
The Lonesome LOD Cloud
Ruben Verborgh
 
OSCON 2011 CouchApps
OSCON 2011 CouchApps
Bradley Holt
 
Introduction to couch_db
Introduction to couch_db
Romain Testard
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
ArangoDB Database
 
Lokijs
Lokijs
Joe Minichino
 

More Related Content

What's hot (20)

Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
ArangoDB Database
 
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
ArangoDB Database
 
OrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data Relationships
Fabrizio Fortino
 
OrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KW
gmccarvell
 
Connecting to a REST API in iOS
Connecting to a REST API in iOS
gillygize
 
Graph Databases & OrientDB
Graph Databases & OrientDB
Arpit Poladia
 
Small Overview of Skype Database Tools
Small Overview of Skype Database Tools
elliando dias
 
Solid pods and the future of the spatial web
Solid pods and the future of the spatial web
Kurt Cagle
 
Using Webservice in iOS
Using Webservice in iOS
Mahboob Nur
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsing
Jussi Pohjolainen
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
Mubashar Iqbal
 
Introduction to column oriented databases
Introduction to column oriented databases
ArangoDB Database
 
State of the Semantic Web
State of the Semantic Web
Ivan Herman
 
RDFa Tutorial
RDFa Tutorial
Ivan Herman
 
elasticsearch basics workshop
elasticsearch basics workshop
Mathieu Elie
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
Marco Gralike
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQL
Luca Garulli
 
The Lonesome LOD Cloud
The Lonesome LOD Cloud
Ruben Verborgh
 
OSCON 2011 CouchApps
OSCON 2011 CouchApps
Bradley Holt
 
Introduction to couch_db
Introduction to couch_db
Romain Testard
 
Query mechanisms for NoSQL databases
Query mechanisms for NoSQL databases
ArangoDB Database
 
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
A Graph Database That Scales - ArangoDB 3.7 Release Webinar
ArangoDB Database
 
OrientDB: Unlock the Value of Document Data Relationships
OrientDB: Unlock the Value of Document Data Relationships
Fabrizio Fortino
 
OrientDB & Node.js Overview - JS.Everywhere() KW
OrientDB & Node.js Overview - JS.Everywhere() KW
gmccarvell
 
Connecting to a REST API in iOS
Connecting to a REST API in iOS
gillygize
 
Graph Databases & OrientDB
Graph Databases & OrientDB
Arpit Poladia
 
Small Overview of Skype Database Tools
Small Overview of Skype Database Tools
elliando dias
 
Solid pods and the future of the spatial web
Solid pods and the future of the spatial web
Kurt Cagle
 
Using Webservice in iOS
Using Webservice in iOS
Mahboob Nur
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsing
Jussi Pohjolainen
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
Mubashar Iqbal
 
Introduction to column oriented databases
Introduction to column oriented databases
ArangoDB Database
 
State of the Semantic Web
State of the Semantic Web
Ivan Herman
 
elasticsearch basics workshop
elasticsearch basics workshop
Mathieu Elie
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
Marco Gralike
 
OrientDB introduction - NoSQL
OrientDB introduction - NoSQL
Luca Garulli
 
The Lonesome LOD Cloud
The Lonesome LOD Cloud
Ruben Verborgh
 
OSCON 2011 CouchApps
OSCON 2011 CouchApps
Bradley Holt
 
Introduction to couch_db
Introduction to couch_db
Romain Testard
 

Viewers also liked (12)

ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
ArangoDB Database
 
Lokijs
Lokijs
Joe Minichino
 
Domain Driven Design and NoSQL TLV
Domain Driven Design and NoSQL TLV
ArangoDB Database
 
ArangoDB
ArangoDB
ArangoDB Database
 
Converting Relational to Graph Databases
Converting Relational to Graph Databases
Antonio Maccioni
 
Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...
Neo4j
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and Modeling
Neo4j
 
Introduction to Graph Databases
Introduction to Graph Databases
Max De Marzi
 
Neo4j Partner Tag Berlin - Potential für System-Integratoren und Berater
Neo4j Partner Tag Berlin - Potential für System-Integratoren und Berater
Neo4j
 
Webinar: RDBMS to Graphs
Webinar: RDBMS to Graphs
Neo4j
 
reveal.js 3.0.0
reveal.js 3.0.0
Hakim El Hattab
 
Neo4j - 5 cool graph examples
Neo4j - 5 cool graph examples
Peter Neubauer
 
ArangoDB – A different approach to NoSQL
ArangoDB – A different approach to NoSQL
ArangoDB Database
 
Domain Driven Design and NoSQL TLV
Domain Driven Design and NoSQL TLV
ArangoDB Database
 
Converting Relational to Graph Databases
Converting Relational to Graph Databases
Antonio Maccioni
 
Designing and Building a Graph Database Application – Architectural Choices, ...
Designing and Building a Graph Database Application – Architectural Choices, ...
Neo4j
 
Working With a Real-World Dataset in Neo4j: Import and Modeling
Working With a Real-World Dataset in Neo4j: Import and Modeling
Neo4j
 
Introduction to Graph Databases
Introduction to Graph Databases
Max De Marzi
 
Neo4j Partner Tag Berlin - Potential für System-Integratoren und Berater
Neo4j Partner Tag Berlin - Potential für System-Integratoren und Berater
Neo4j
 
Webinar: RDBMS to Graphs
Webinar: RDBMS to Graphs
Neo4j
 
Neo4j - 5 cool graph examples
Neo4j - 5 cool graph examples
Peter Neubauer
 
Ad

Similar to ArangoDB - Using JavaScript in the database (20)

Multi model-databases
Multi model-databases
Michael Hackstein
 
Multi model-databases
Multi model-databases
ArangoDB Database
 
Guacamole Fiesta: What do avocados and databases have in common?
Guacamole Fiesta: What do avocados and databases have in common?
ArangoDB Database
 
Oslo bekk2014
Oslo bekk2014
Max Neunhöffer
 
NodeJS
NodeJS
Alok Guha
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
ArangoDB Database
 
Running complex data queries in a distributed system
Running complex data queries in a distributed system
ArangoDB Database
 
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
ArangoDB Database
 
Deep Dive on ArangoDB
Deep Dive on ArangoDB
Max Neunhöffer
 
Processing large-scale graphs with Google Pregel
Processing large-scale graphs with Google Pregel
Max Neunhöffer
 
An introduction to multi-model databases
An introduction to multi-model databases
ArangoDB Database
 
An introduction to multi-model databases
An introduction to multi-model databases
Berta Hermida Plaza
 
An E-commerce App in action built on top of a Multi-model Database
An E-commerce App in action built on top of a Multi-model Database
ArangoDB Database
 
MongoDB and Web Scrapping with the Gyes Platform
MongoDB and Web Scrapping with the Gyes Platform
MongoDB
 
Intravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
DataStax Academy
 
Building powerful apps with ArangoDB & KeyLines
Building powerful apps with ArangoDB & KeyLines
Cambridge Intelligence
 
FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
ArangoDB Database
 
Os Gottfrid
Os Gottfrid
oscon2007
 
Polyglot Persistence & Multi Model-Databases at JMaghreb3.0
Polyglot Persistence & Multi Model-Databases at JMaghreb3.0
ArangoDB Database
 
Guacamole Fiesta: What do avocados and databases have in common?
Guacamole Fiesta: What do avocados and databases have in common?
ArangoDB Database
 
Deep dive into the native multi model database ArangoDB
Deep dive into the native multi model database ArangoDB
ArangoDB Database
 
Running complex data queries in a distributed system
Running complex data queries in a distributed system
ArangoDB Database
 
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
Webinar: ArangoDB 3.8 Preview - Analytics at Scale
ArangoDB Database
 
Processing large-scale graphs with Google Pregel
Processing large-scale graphs with Google Pregel
Max Neunhöffer
 
An introduction to multi-model databases
An introduction to multi-model databases
ArangoDB Database
 
An introduction to multi-model databases
An introduction to multi-model databases
Berta Hermida Plaza
 
An E-commerce App in action built on top of a Multi-model Database
An E-commerce App in action built on top of a Multi-model Database
ArangoDB Database
 
MongoDB and Web Scrapping with the Gyes Platform
MongoDB and Web Scrapping with the Gyes Platform
MongoDB
 
Intravert Server side processing for Cassandra
Intravert Server side processing for Cassandra
Edward Capriolo
 
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
NYC* 2013 - "Advanced Data Processing: Beyond Queries and Slices"
DataStax Academy
 
Building powerful apps with ArangoDB & KeyLines
Building powerful apps with ArangoDB & KeyLines
Cambridge Intelligence
 
FOXX - a Javascript application framework on top of ArangoDB
FOXX - a Javascript application framework on top of ArangoDB
ArangoDB Database
 
Polyglot Persistence & Multi Model-Databases at JMaghreb3.0
Polyglot Persistence & Multi Model-Databases at JMaghreb3.0
ArangoDB Database
 
Ad

More from ArangoDB Database (20)

ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
ArangoDB Database
 
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB Database
 
GraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDB
ArangoDB Database
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDB
ArangoDB Database
 
Getting Started with ArangoDB Oasis
Getting Started with ArangoDB Oasis
ArangoDB Database
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
ArangoDB Database
 
Hacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge Graphs
ArangoDB Database
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
ArangoDB Database
 
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoDB Database
 
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB Database
 
Webinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB Oasis
ArangoDB Database
 
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB Database
 
3.5 webinar
3.5 webinar
ArangoDB Database
 
Webinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDB
ArangoDB Database
 
Are you a Tortoise or a Hare?
Are you a Tortoise or a Hare?
ArangoDB Database
 
The Computer Science Behind a modern Distributed Database
The Computer Science Behind a modern Distributed Database
ArangoDB Database
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake
ArangoDB Database
 
Creating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on Mesos
ArangoDB Database
 
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ATO 2022 - Machine Learning + Graph Databases for Better Recommendations (3)....
ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
Machine Learning + Graph Databases for Better Recommendations V2 08/20/2022
ArangoDB Database
 
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
Machine Learning + Graph Databases for Better Recommendations V1 08/06/2022
ArangoDB Database
 
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB 3.9 - Further Powering Graphs at Scale
ArangoDB Database
 
GraphSage vs Pinsage #InsideArangoDB
GraphSage vs Pinsage #InsideArangoDB
ArangoDB Database
 
Graph Analytics with ArangoDB
Graph Analytics with ArangoDB
ArangoDB Database
 
Getting Started with ArangoDB Oasis
Getting Started with ArangoDB Oasis
ArangoDB Database
 
Custom Pregel Algorithms in ArangoDB
Custom Pregel Algorithms in ArangoDB
ArangoDB Database
 
Hacktoberfest 2020 - Intro to Knowledge Graphs
Hacktoberfest 2020 - Intro to Knowledge Graphs
ArangoDB Database
 
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
gVisor, Kata Containers, Firecracker, Docker: Who is Who in the Container Space?
ArangoDB Database
 
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoML Pipeline Cloud - Managed Machine Learning Metadata
ArangoDB Database
 
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB 3.7 Roadmap: Performance at Scale
ArangoDB Database
 
Webinar: What to expect from ArangoDB Oasis
Webinar: What to expect from ArangoDB Oasis
ArangoDB Database
 
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB 3.5 Feature Overview Webinar - Sept 12, 2019
ArangoDB Database
 
Webinar: How native multi model works in ArangoDB
Webinar: How native multi model works in ArangoDB
ArangoDB Database
 
Are you a Tortoise or a Hare?
Are you a Tortoise or a Hare?
ArangoDB Database
 
The Computer Science Behind a modern Distributed Database
The Computer Science Behind a modern Distributed Database
ArangoDB Database
 
Fishing Graphs in a Hadoop Data Lake
Fishing Graphs in a Hadoop Data Lake
ArangoDB Database
 
Creating Fault Tolerant Services on Mesos
Creating Fault Tolerant Services on Mesos
ArangoDB Database
 

Recently uploaded (20)

A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
A Constitutional Quagmire - Ethical Minefields of AI, Cyber, and Privacy.pdf
Priyanka Aash
 
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC and Open Hackathons Monthly Highlights June 2025
OpenACC
 
From Manual to Auto Searching- FME in the Driver's Seat
From Manual to Auto Searching- FME in the Driver's Seat
Safe Software
 
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Smarter Aviation Data Management: Lessons from Swedavia Airports and Sweco
Safe Software
 
Python Conference Singapore - 19 Jun 2025
Python Conference Singapore - 19 Jun 2025
ninefyi
 
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Oh, the Possibilities - Balancing Innovation and Risk with Generative AI.pdf
Priyanka Aash
 
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Enhance GitHub Copilot using MCP - Enterprise version.pdf
Nilesh Gule
 
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
“MPU+: A Transformative Solution for Next-Gen AI at the Edge,” a Presentation...
Edge AI and Vision Alliance
 
The Future of Product Management in AI ERA.pdf
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
"Database isolation: how we deal with hundreds of direct connections to the d...
"Database isolation: how we deal with hundreds of direct connections to the d...
Fwdays
 
Daily Lesson Log MATATAG ICT TEchnology 8
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
AI Agents and FME: A How-to Guide on Generating Synthetic Metadata
Safe Software
 
Quantum AI: Where Impossible Becomes Probable
Quantum AI: Where Impossible Becomes Probable
Saikat Basu
 
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
WebdriverIO & JavaScript: The Perfect Duo for Web Automation
digitaljignect
 
Techniques for Automatic Device Identification and Network Assignment.pdf
Techniques for Automatic Device Identification and Network Assignment.pdf
Priyanka Aash
 
Securing Account Lifecycles in the Age of Deepfakes.pptx
Securing Account Lifecycles in the Age of Deepfakes.pptx
FIDO Alliance
 
OpenPOWER Foundation & Open-Source Core Innovations
OpenPOWER Foundation & Open-Source Core Innovations
IBM
 
You are not excused! How to avoid security blind spots on the way to production
You are not excused! How to avoid security blind spots on the way to production
Michele Leroux Bustamante
 
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
" How to survive with 1 billion vectors and not sell a kidney: our low-cost c...
Fwdays
 
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
CapCut Pro Crack For PC Latest Version {Fully Unlocked} 2025
pcprocore
 

ArangoDB - Using JavaScript in the database

  • 1. ArangoDB /* Using Javascript in the database */ Jan Steemann, triAGENS, Cologne
  • 3. ArangoDB.explain() { "type": "NoSQL database", "openSource": true, "version": 1.0, "builtWith": [ "C", "C++", "js" ], "Javascript": [ "client side", "server side" ], "uses": [ "V8" ] } www.arangodb.org © [email protected]
  • 4. Documents and collections ArangoDB is a database that works with documents Documents are sets of name / value pairs (think of JSON objects), e.g. { "name": "Jan", "age": 37 } Documents are organised in collections (like tables in relational databases) www.arangodb.org © [email protected]
  • 5. Data types: JSON! ArangoDB operates on JSON documents JSON data can be saved as-is: db.users.save({ "name": "Jan", "uses": [ "vi", "js", "C++" ] }); www.arangodb.org © [email protected]
  • 6. Schema-free Documents can be heterogenous – even in the same collection, e.g. { "name": "Jan", "age": 37 }, { "name": "Tim", "likes": [ "js" ] }, { "name": { "first": "Patrick", "last": "Star" } } No need to care about schemas www.arangodb.org © [email protected]
  • 7. API & protocols ArangoDB server functionality is exposed via an HTTP REST API ArangoDB answers HTTP queries, so it can be used from the browser Simple to use from Javascript clients (3rd party) drivers available for node.js, Ruby, PHP, ... Javascript-enabled client shell provided www.arangodb.org © [email protected]
  • 9. Querying is simple Query a document by its unique id / key: db._document("users/9558905"); Query by providing an example: db.users.byExample({ "name": "Jan", "age": 37 }); www.arangodb.org © [email protected]
  • 10. Indexes ArangoDB allows querying on any document attributes or sub-attributes Secondary indexes can be created for higher query performance: • Hash indexes (equality queries) • Skiplists (range queries) • 2d geo indexes (location queries) www.arangodb.org © [email protected]
  • 11. Geo index examples // get b a r n ea r es t t o coor d in a t e db.bars.near(48.51, 2.21).limit(1); // get a ll s h op s w it h in r a d iu s // a r ou n d coor d in a t e db.shops.within(48.51, 2.21, rad); www.arangodb.org © [email protected]
  • 12. References ArangoDB can store references between documents References are documents with two endpoints (the documents they connect) Reference documents can carry own attributes www.arangodb.org © [email protected]
  • 13. References example Users documents: Relations documents: (references) { "name": "Jan", "age": 37 { } "_from": "users/jan", "_to": "users/tim", { "type": "knows", "name": "Tim", } "city": "Paris" } // q u er y ou t b ou n d r ela t ion s f r om "J a n " db.relations.outEdges(jan); // => tim www.arangodb.org © [email protected]
  • 14. Graph queries References make it possible to process graphs with ArangoDB Some special functions are provided to determine paths in a graph etc. Can write own Javascript functions for special traversals www.arangodb.org © [email protected]
  • 15. Query language ArangoDB can also answer complex SQL-like queries Such queries are expressed in ArangoDB's textual query language This language allows joins, sub-queries, aggregation etc. www.arangodb.org © [email protected]
  • 16. Example query FOR u IN users It er a t or FILTER u.addr.country == "US" && (u.isConfirmed == true || u.age >= 18) F ilt er LET userLogins = ( FOR l IN logins FILTER l.userId == u.id RETURN l ) S u b q u er y RETURN { "user": u, "logins": LENGTH(userLogins) } R es u lt www.arangodb.org © [email protected]
  • 18. Application server ArangoDB can answer web requests directly This also makes it an application server Users can extend its functionality with server side Javascript „actions“ Actions are user-defined functions that contain custom business logic www.arangodb.org © [email protected]
  • 19. Actions Actions are bound to URLs and executed when URLs are called, e.g. /users?name=... => function(...) /users/.../friends => function(...) www.arangodb.org © [email protected]
  • 20. Actions example function (req, res) { // get r eq u es t ed u s er f r om d b , // n a m e is r ea d f r om U R L p a r a m et er var u = db.users.byExample({ "username": req.urlParameters.name }); // r em ov e p a s s w or d h a s h delete u.hashedPassword; // b ef or e r et u r n in g t o ca ller actions.resultOk(req, res, 200, u); } www.arangodb.org © [email protected]
  • 21. Actions – Use cases Filter out sensitive data before responding Validate input Check privileges Check and enforce constraints Aggregate data from multiple queries into a single response Carry out data-intensive operations www.arangodb.org © [email protected]
  • 23. ArangoDB - summary Flexible in terms of data modelling and querying API is based on web standards: HTTP, REST, JSON Easy to use from Javascript clients Can be used as application server Functionality can be extended with server side Javascript „actions“ www.arangodb.org © [email protected]
  • 24. Thanks! Any questions? Спасибо Grazie Teşekkürler ¡Gracias! Merci! Хвала Dank je wel Ευχαριστώ ありがとう 고마워 Tack så mycket Danke www.arangodb.org © [email protected]
  • 25. Give it a try! ArangoDB source repository: https://www.github.com/triAGENS/ArangoDB (use master branch) Website: http://www.arangodb.org/ Builds available for Homebrew and several Linux distributions Twitter: #arangodb, @arangodb Google group: ArangoDB www.arangodb.org © [email protected]
  • 26. Roadmap MVCC / ACID transactions Triggers Synchronous and asynchronous replication www.arangodb.org © [email protected]
  • 27. Thank you! Stay in Touch: • Fork me on github • Google Group: ArangoDB • Twitter: @steemann & @arangodb • www.arangodb.org www.arangodb.org © [email protected]