German Video: NoSQL Meets Mobile Cologne | ArangoDB 2013
Last week Jan (core member of ArangoDB and the brain behind AQL and many other parts) was invited by “mobile.cologne” – a user group here in Cologne dealing with mobile development.
In this talk Jan gives a general overview on nosql databases and the different flavors. He explains how to query a nosql database and he evaluates how a nosql database can be used in a mobile app.
Warning: The talk is in German. If you want to hear it in English, let us know in the comments. 🙂
“NoSQL meets mobile.cologne” by Jan Steemann.
Getting Started with ArangoDB & Symfony: Part 1 | ArangoDB 2013
In this tutorial we will implement a very simple movie database as an example of how to use ArangoDB together with Symfony 2. We assume for the tutorial that you know the basic concepts of Symfony2. No prior ArangoDB knowledge is required.
The demo shows how to create, edit, update and delete movies, how to select a list of movies from the database in two different ways. We’ll use the simple query API for most examples. The “search for a topic” feature uses ArangoDB’s query language (AQL), a convenient sql-like way to query ArangoDB.
You can download the completed demo at Github.
A short word on ArangoDB
Warning - a paragraph of marketing ahead! ;-) ArangoDB is an open-source mostly-memory database with a flexible data model for documents and graphs for modern web applications. With ArangoDB you build high performance applications in short time - it is schema-less and has a full-blown query language nevertheless (there is no need to write map/reduce functions if your queries get more complicate) . You can even extend ArangoDB by adding your own Javascript/Ruby methods to the database.
Libraries & infrastructure
The following components are used
- ArangoDB 1.2 (installable via one-click-installers for many operating systems)
- Symfony 2.2
- the ArangoDB PHP driver
- the MopArangoDbBundle
What’s this? Since Symfony is a PHP framework we need the PHP driver for ArangoDB. The MopArangoDbBundle integrates the PHP driver into Symfony: having this bundle installed, you can config the connection to ArangoDB in the config.yml (note: the bundle also offers a FOSUserBundle integration which is not used in this demo, but might be interested for you if you are looking for a user management system out of the box).
Installing ArangoDB
Now grab your copy of ArangoDB from the download page and install it. There are binaries available for many common platforms (Linux, OSX, Windows). Make sure that ArangoDB is up and running by opening the graphical user interface in your browser:
http://localhost:8529/_admin/html/index.html
Configuring Symfony for use with ArangoDB
First thing we have to do is to tell Symfony that we want to work with ArangoDB. So we add the two required bundles to composer.json and run “php composer.phar update” as usual.
// path/to/myapp/composer.json
"require": {
…
"triagens/ArangoDb": "dev-devel",
"mop/arangodbbundle" : "dev-master"
…
},
Note: for this tutorial a feature was added to the ArangoDB PHP driver which is only available in the “dev-devel” branch at the time of writing this text.
Having MopArangodbBundle installed we can add our connection settings to config.yml
//myapp/app/config/config.yml
mop_arango_db:
default_connection: main #will be set to the first connection if not present
connections:
main:
host: 127.0.0.1
port: 8529
We are done.
In Symfony we can now access the default connection to ArangoDB with
$connection = $this->get('mop_arangodb.default_connection');
The end
Congrats, you have reached the end of part 1 the tutorial. There is more:
- Symfony 2 & ArangoDB - part 1: setup and getting a connection
- Symfony 2 & ArangoDB - part 2: data modelling & fetching a list from the DB
- Symfony 2 & ArangoDB - part 3: working with forms & data transformers
- Symfony 2 & ArangoDB - part 4: extending ArangoDB Document & querying via AQL
ArangoDB & Symfony Integration: Part 2 | ArangoDB ’13
You can download the completed demo at Github.
The data structure
Our app deals with movies: each movie has a title, a year of release and it is assigned to a genre. Each movie deals with none, one or many topics.
In a relational database we would probably create a table movie and another table topic and join them with a shared movie id.
ArangoDB follows like other document stores the “aggregate model” approach: In short terms this means that you should put data that is often needed together into one document. Remember: documents are a bit like rows in the relation world; in nosql world they can have a nested structure.
ArangoDB & Symfony Integration: Part 3 Guide | ArangoDB ’13
You can download the completed demo at Github.
Working with forms
The next example shows the use of ArangoDB with Symfony’s form component.
This is how our form will look like. The topics are represented as a text field and the user is required to separate them by commas. This delivers questionable user experience, but leads to an interesting question: how can we transform our topics array from our movie document to a text field? And: we’ll need it at least two times, both for creating and editing movies.
ArangoDB & Symfony Integration: Part 4 Guide | ArangoDB ’13
You can download the completed demo at Github.
Extending Arangodb\Document
The next thing we want to improve are all those noisy set calls in the controller:
// src/Triagens/ArangodbBundle/Controller/DefaultController.php
if ($form->isValid()) {
$movie = new ArangoDocument();
$movie->set("title",$form->get("title")->getData());
$movie->set("released",$form->get("released")->getData());
$movie->set("genre",$form->get("genre")->getData());
// and so on ... my eyes hurt!
}
API Implementors Gathering: ArangoDB 2013
Dear API Implementors,
We want to make it simpler for you to keep up with the development of ArangoDB. We therefore created a dedicated place for all API implementors. If you are implementing a Driver, ODM or database access tool for ArangoDB, this is the right place for you. In addition to sharing information about the changing API, we want to discuss patterns and ideas with each other.
The team behind ArangoDB will announce API changes and enhancements in the issues of this project, so you have one place to get all the up to date information. Apart from that, the community is independent from the ArangoDB team.
We want to make this a central, open place for all API implementors. So if you want to be part of this group, just introduce yourself and we will add you to the list. Then just watch the Repository to get all information in your inbox.
We already have the people behind the PHP and Ruby drivers on board. We’re looking forward to discussing with you and build a multi-programming language community around ArangoDB. So join us.
CoffeeScript in ArangoDB: Feature Preview | ArangoDB 2013
In my blog post about npm packages, I tried to use underscore for ArangoDB. I found that the easiest way to archive this, is using the nodes package manager NPM. Node packages and modules follow the Common.JS specification, so they can be used by ArangoDB.
Why not try to use the package coffee-script as well? Install it using
npm install coffee-script
and that’s it. Unfortunately, CoffeeScript use a module “path”, which is not a CommonJS module. I assume that most of the functionality is part or will be part of the module “fs”. The “path.js” from node.js is simple JavaScript code with some references like
'path.exists is now called `fs.exists`'
Being brave, I simply copied the file into my module path and tried again. The next obstacle is node’s global variable “process”. Luckily, this is only used to check for Windows in the module “path”. Also ignoring the module “vm” used to execute JavaScript code, this allows one to actually load CoffeScript into ArangoDB.
arangosh> process = {};
{ }
arangosh> var cs = require("coffee-script");
arangosh> cs.compile("a = 1\nopposite = true\na = -a if opposite", {});
(function() {
var a, opposite;
a = 1;
opposite = true;
if (opposite) {
a = -a;
}
}).call(this);
So, I can now use CoffeeScript definition within ArangoDB. Some of the loaders must be adjusted to check for both “.js” and “.coffee” files. Afterwards it should be possible, to define an action in CoffeeScript as well as JavaScript.
ArangoDB 1.2.0 Released: What’s New? | ArangoDB 2013
We are proud to announce the release of ArangoDB 1.2.0. You can find an overview of the new features in these blog posts:
- New Features in ArangoDB 1.2
- Simplifications in ArangoDB 1.2
- API changes in ArangoDB 1.2 If you are upgrading your database from 1.1, please carefully read
- Upgrading to ArangoDB 1.2 The source code is available from the 1.2 branch on
github, the binary packages from our download page. The new version has also been submitted to homebrew and Apple's AppStore.
Last Minute Remarks
We have decided to switch the statistics functions off, by default.
You can switch them on by changing the config file. The current statistics functions are now obsolescent. We want to switch to a more flexible and less time consuming implementation in 1.3.
Using NPM Packages for ArangoDB: Enhance Functionality | 2013
ArangoDB follows the Common.JS specification for modules. However, it would be very convenient, if there was an easy way to install a package like “underscore.js”. These package are, for instance, available using NPM. There is a draft for packages on Common.JS which seems to be compatible with NPM.
NPM has a neat way of dealing with version conflicts. Basically, it allows multiple versions to exists simultaneously. For example, assume you have 4 packages A, B, C, D. A requires B and C and D, B requires C. Then directory layout might be as follows.
node_modules
|
+- A
| |
| +- node_modules
| |
| +- B
| | |
| | +- node_modules
| | |
| | +- C (1.0.0)
| |
| +- C (2.0.0)
|
+- D
Package B will see package C in version 1.0.0, while package A sees package C in version 2.0.0.
<!--more-->
This behaviour is easy to implement in ArangoDB. In addition to “Module” there is now a “Package”. Each package has it own module cache. When a package requires a module, the package hierarchy is traversed from the current package to the root (or global) package, until the module is found.
In order to use underscore, switch into the package directory and use NPM to install it
unix> cd /tmp/packages
unix> npm install underscore
npm http GET https://registry.npmjs.org/underscore
npm http 304 https://registry.npmjs.org/underscore
underscore@1.4.4 node_modules/underscore
Now start arangosh with the new “–javascript.package-path” option and enjoy underscore.
unix> arangosh --javascript.package-path /tmp/packages
arangosh> var _ = require("underscore");
arangosh> _.max([1,2,3])
3
ArangoDB 1.2: Simplifications Overview | ArangoDB 2013
The upcoming 1.2 version of ArangoDB will provide several improvements and fixes.
Apart from the additional features the new version provides, the following changes might also be very interesting for users and driver maintainers:
(more…)
Get the latest tutorials,
blog posts and news:
Thanks for subscribing! Please check your email for further instructions.