More Efficient Data Exports with new Export API

ArangoDB 2.6 provides a specialized export API for exporting all documents from a collection and shipping them to a client application. It is rather limited but faster than the general-purpose AQL cursor API and can store its snapshots using less memory.

export_api

A side effect of the speedup is that the first results will arrive much earlier in the client application. This will help in reducing client connection timeouts in case clients are enforcing them on temporarily non-responding connections. (more…)

More info...

New Cursor API leads to significant performance improvements

This week we pushed some modifications for ArangoDB’s cursor API into the devel branch. The change will result in less copying of AQL query results between the AQL and the HTTP layers. As a positive side effect, this will reduce the amount of garbage collection the built-in V8 has to do.

These modifications should improve the cursor API performance significantly for many cases, while at the same time keeping its REST API stable. Client programs do not need to be adjusted to reap the benefits. In a blog post, Jan shows some first unscientific performance tests comparing the old cursor API with its new, improved implementation.
(more…)

More info...

AQL: Improved data-modification queries

Data-modification queries were enhanced in ArangoDB 2.4 to be able to also return the inserted, update or removed documents. For example, the following statement inserted a few documents and also returned them with all their attributes:

FOR i IN 1..10
  INSERT { value: i } IN test
  LET inserted = NEW
  RETURN inserted

The syntax for returning documents from data-modification queries only supported the exact above format. Using a LET clause was required, and the RETURN clause was limited to returning the variable introduced by the LET. These syntax restrictions have been lifted in the devel branch, which will become release 2.6 eventually.

The changes make returning values from data-modification statements easier and also more flexible.
(more…)

More info...

Preview of the UPSERT Command

This week saw the completion of the AQL UPSERT command. This command will be very helpful in a lot of use cases, including the following:

  • ensure that a document exists
  • update a document if it exists, otherwise create it
  • replace a document if it exists, otherwise create it

The UPSERT command is executed on the server side and so delivers client applications from issuing a fetch command followed by a separate, conditional UPDATE or INSERT command.

The general format of an UPSERT statement is:

UPSERT search-document
INSERT insert-expression
UPDATE update-expression
IN collection-name

Jan collected a few example invocations of UPSERT in his blog.

More info...

Analyzing Git commits with ArangoDB

I often find myself searching for certain commits using git log and friends. While I really love the power and flexibility that come with the git and other Unix command-line tools, sometimes it can be more convenient to use a database to filter and aggregate commit data.

I gave it a quick try yesterday and imported the commit history of ArangoDB’s Git repository into ArangoDB and ran some queries on the data.

// retrieving number of commits per month / year
query = 'FOR commit IN commits 
           COLLECT year = DATE_YEAR(commit.date), month = DATE_MONTH(commit.date) 
           WITH COUNT INTO count 
         RETURN { month: CONCAT(year, "/", month), count: count }';
db._query(query).toArray();

While the query results for our repository may not be interesting for everyone, I think it is still worth sharing what I did. Even though I didn’t try it, I think the overall procedure is applicable with any other Git repository.

More queries and how to convert and import Git commits in ArangoDB: Read on in Jan’s Blog

More info...

Securing your Foxx with API Keys

ArangoDB’s Foxx allows you to easily build an API to access your data sources. But now this API is either public or restricted to users having an account, but those still get unlimited access.

In many use cases you do not want to expose your data in this fashion, but you want to expose it with a more controllable access pattern and want to restrict the requests one user could issue in a certain time period. Popular examples for these API restrictions are Twitter or Facebook. This allows you to offer all of your data but only in limited chunks, and then possibly charge your customers to increase the chunk limit they can request.

All this is done via API keys, which are bound to a user and has become a common pattern to monetize the data you have collected. (more…)

More info...

Using dynamic Attribute Names in AQL

On our mailing list, there is quite often the question whether attribute names in objects returned from AQL queries can be made dynamic. Jan discusses in his blog how such dynamic attribute names could be expressed and shows the current implementation that comes with ArangoDB 2.5 – adapting an ES6 proposal that might bring robust dynamic variable names to JavaScript as well.

In ArangoDB 2.5 you will be able to use dynamic variable names as follows:

FOR doc IN collection
  LET type = doc.type;
  RETURN { [type] : doc.value }

Functions are allowed as well:

FOR i IN 1..3 
  RETURN { 
    [ CONCAT('test', i) ] : i
  }    

Read on here

More info...

Using Custom Visitors in AQL Graph Traversals

Visitors by jan

Jan blogged about some recent extensions for the AQL graph traversal functionality in ArangoDB. These extensions allow invoking user-defined JavaScript code for filtering and results generation in AQL queries that contain traversals.

This should make AQL graph traversals much more powerful than before.

Additionally, AQL graph traversals get more configurable, allowing to write traversal functions with control-flow logic and complex filtering. As a side-effect, this change facilitates writing specialized traversal functions with much higher efficiency than the general-purpose, cover-all-cases default ones.

Continued here on J@ArangoDB’s blog

More info...

Building a self-learning game with ArangoDB, io.js & AngularJS in half a day.

With the ArangoDB Foxx Microservice Framework we’ve introduced an easy way to create a Web API right on top of the NoSQL database.

In early January Max challenged Andreas (AngularJS / NodeJS) that they could build a full-stack application within half a day.

The web application – in short – is a guessing game, in which the computer tries to guess a thing or animal you think of by asking a series of questions, for which you provide the answers. (more…)

More info...

Returning results from modifying AQL operations (V 2.4)

ArangoDB provides many options for finding and modifying data. Though there are several more specialized operation, data-modification AQL queries are the most general solution in ArangoDB. They allow to find documents using arbitrary filter criteria, and to modify or remove the documents once found.

Read in Jan’s blog how INSERT, UPDATE, REMOVE and REPLACE operations can now return modified documents and allow to find, modify and return documents from the same AQL query. Read on

More info...

Get the latest tutorials,
blog posts and news: