mirror of https://gitee.com/bigwinds/arangodb
Docs: Use standard Markdown notation for headlines and disable MarkdownPP
This commit is contained in:
parent
93eb443366
commit
e4eeb57e30
|
@ -1,7 +1,9 @@
|
|||
!CHAPTER Array Operators
|
||||
Array Operators
|
||||
===============
|
||||
|
||||
|
||||
!SECTION Array expansion
|
||||
Array expansion
|
||||
---------------
|
||||
|
||||
In order to access a named attribute from all elements in an array easily, AQL
|
||||
offers the shortcut operator <i>[\*]</i> for array variable expansion.
|
||||
|
@ -69,7 +71,8 @@ FOR u IN users
|
|||
RETURN { name: u.name, friends: (FOR f IN u.friends RETURN f.name) }
|
||||
```
|
||||
|
||||
!SECTION Array contraction
|
||||
Array contraction
|
||||
-----------------
|
||||
|
||||
In order to collapse (or flatten) results in nested arrays, AQL provides the <i>[\*\*]</i>
|
||||
operator. It works similar to the <i>[\*]</i> operator, but additionally collapses nested
|
||||
|
@ -149,7 +152,8 @@ Note that the elements are not de-duplicated. For a flat array with only unique
|
|||
elements, a combination of [UNIQUE()](../Functions/Array.md#unique) and
|
||||
[FLATTEN()](../Functions/Array.md#flatten) is advisable.
|
||||
|
||||
!SECTION Inline expressions
|
||||
Inline expressions
|
||||
------------------
|
||||
|
||||
It is possible to filter elements while iterating over an array, to limit the amount
|
||||
of returned elements and to create a projection using the current array element.
|
||||
|
@ -214,7 +218,7 @@ older than 40 years are returned per user:
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Inline filter
|
||||
### Inline filter
|
||||
|
||||
To return only the names of friends that have an *age* value
|
||||
higher than the user herself, an inline *FILTER* can be used:
|
||||
|
@ -228,7 +232,7 @@ The pseudo-variable *CURRENT* can be used to access the current array element.
|
|||
The *FILTER* condition can refer to *CURRENT* or any variables valid in the
|
||||
outer scope.
|
||||
|
||||
!SUBSECTION Inline limit
|
||||
### Inline limit
|
||||
|
||||
The number of elements returned can be restricted with *LIMIT*. It works the same
|
||||
as the [limit operation](../Operations/Limit.md). *LIMIT* must come after *FILTER*
|
||||
|
@ -267,7 +271,7 @@ per user:
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Inline projection
|
||||
### Inline projection
|
||||
|
||||
To return a projection of the current element, use *RETURN*. If a *FILTER* is
|
||||
also present, *RETURN* must come later.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Advanced features
|
||||
Advanced features
|
||||
=================
|
||||
|
||||
This section covers additional, powerful AQL features, which you may wanna look
|
||||
into once you made yourself familiar with the basics of the query language.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Common Errors
|
||||
Common Errors
|
||||
=============
|
||||
|
||||
!SECTION String concatenation
|
||||
String concatenation
|
||||
--------------------
|
||||
|
||||
In AQL, strings must be concatenated using the [CONCAT()](Functions/String.md#concat)
|
||||
function. Joining them together with the `+` operator is not supported. Especially
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Data Queries
|
||||
Data Queries
|
||||
============
|
||||
|
||||
!SECTION Data Access Queries
|
||||
Data Access Queries
|
||||
-------------------
|
||||
|
||||
Retrieving data from the database with AQL does always include a **RETURN**
|
||||
operation. It can be used to return a static value, such as a string:
|
||||
|
@ -72,7 +74,8 @@ is usually put at the very end, after *FILTER*, *SORT* and other operations.
|
|||
|
||||
See the [High Level Operations](Operations/README.md) chapter for more details.
|
||||
|
||||
!SECTION Data Modification Queries
|
||||
Data Modification Queries
|
||||
-------------------------
|
||||
|
||||
AQL supports the following data-modification operations:
|
||||
|
||||
|
@ -86,7 +89,7 @@ Below you find some simple example queries that use these operations.
|
|||
The operations are detailed in the chapter [High Level Operations](Operations/README.md).
|
||||
|
||||
|
||||
!SUBSECTION Modifying a single document
|
||||
### Modifying a single document
|
||||
|
||||
Let's start with the basics: `INSERT`, `UPDATE` and `REMOVE` operations on single documents.
|
||||
Here is an example that insert a document in an existing collection *users*:
|
||||
|
@ -164,7 +167,7 @@ or
|
|||
REMOVE { _key: "GilbertoGil" } IN users
|
||||
```
|
||||
|
||||
!SUBSECTION Modifying multiple documents
|
||||
### Modifying multiple documents
|
||||
|
||||
Data-modification operations are normally combined with *FOR* loops to
|
||||
iterate over a given list of documents. They can optionally be combined with
|
||||
|
@ -198,7 +201,7 @@ FOR u IN users
|
|||
REMOVE u IN backup
|
||||
```
|
||||
|
||||
!SUBSECTION Returning documents
|
||||
### Returning documents
|
||||
|
||||
Data-modification queries can optionally return documents. In order to reference
|
||||
the inserted, removed or modified documents in a `RETURN` statement, data-modification
|
||||
|
@ -233,7 +236,7 @@ In all cases the full documents will be returned with all their attributes,
|
|||
including the potentially auto-generated attributes such as `_id`, `_key`, or `_rev`
|
||||
and the attributes not specified in the update expression of a partial update.
|
||||
|
||||
!SUBSUBSECTION Projections
|
||||
#### Projections
|
||||
|
||||
It is possible to return a projection of the documents in `OLD` or `NEW` instead of
|
||||
returning the entire documents. This can be used to reduce the amount of data returned
|
||||
|
@ -247,7 +250,7 @@ FOR i IN 1..100
|
|||
RETURN NEW._key
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Using OLD and NEW in the same query
|
||||
#### Using OLD and NEW in the same query
|
||||
|
||||
For `UPDATE`, `REPLACE` and `UPSERT` statements, both `OLD` and `NEW` can be used
|
||||
to return the previous revision of a document together with the updated revision:
|
||||
|
@ -259,7 +262,7 @@ FOR u IN users
|
|||
RETURN { old: OLD, new: NEW }
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Calculations with OLD or NEW
|
||||
#### Calculations with OLD or NEW
|
||||
|
||||
It is also possible to run additional calculations with `LET` statements between the
|
||||
data-modification part and the final `RETURN` of an AQL query. For example, the following
|
||||
|
@ -276,7 +279,7 @@ LET opType = IS_NULL(OLD) ? "insert" : "update"
|
|||
RETURN { _key: NEW._key, type: opType }
|
||||
```
|
||||
|
||||
!SUBSECTION Restrictions
|
||||
### Restrictions
|
||||
|
||||
The name of the modified collection (*users* and *backup* in the above cases)
|
||||
must be known to the AQL executor at query-compile time and cannot change at
|
||||
|
@ -299,7 +302,7 @@ Finally, data-modification operations can optionally be followed by `LET` and `R
|
|||
but not by other statements such as `SORT`, `COLLECT` etc.
|
||||
|
||||
|
||||
!SUBSECTION Transactional Execution
|
||||
### Transactional Execution
|
||||
|
||||
On a single server, data-modification operations are executed transactionally.
|
||||
If a data-modification operation fails, any changes made by it will be rolled
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
!CHAPTER Combining Graph Traversals
|
||||
!SUBSECTION Finding the start vertex via a geo query
|
||||
Combining Graph Traversals
|
||||
==========================
|
||||
### Finding the start vertex via a geo query
|
||||
Our first example will locate the start vertex for a graph traversal via [a geo index](../../Manual/Indexing/Geo.html).
|
||||
We use [the city graph](../../Manual/Graphs/index.html#the-city-graph) and its geo indices:
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER Combining queries
|
||||
Combining queries
|
||||
=================
|
||||
|
||||
!SUBSECTION Subqueries
|
||||
### Subqueries
|
||||
|
||||
Wherever an expression is allowed in AQL, a subquery can be placed. A subquery
|
||||
is a query part that can introduce its own local variables without affecting
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Counting
|
||||
Counting
|
||||
========
|
||||
|
||||
!SECTION Amount of documents in a collection
|
||||
Amount of documents in a collection
|
||||
-----------------------------------
|
||||
|
||||
To return the count of documents that currently exist in a collection,
|
||||
you can call the [LENGTH() function](../Functions/Array.md#length):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Data-modification queries
|
||||
Data-modification queries
|
||||
=========================
|
||||
|
||||
The following operations can be used to modify data of multiple documents
|
||||
with one query. This is superior to fetching and updating the documents individually
|
||||
|
@ -6,7 +7,8 @@ with multiple queries. However, if only a single document needs to be modified,
|
|||
ArangoDB's specialized data-modification operations for single documents
|
||||
might execute faster.
|
||||
|
||||
!SECTION Updating documents
|
||||
Updating documents
|
||||
------------------
|
||||
|
||||
To update existing documents, we can either use the *UPDATE* or the *REPLACE*
|
||||
operation. *UPDATE* updates only the specified attributes in the found documents,
|
||||
|
@ -67,7 +69,8 @@ the first error. In single-server mode, all modifications done by the query will
|
|||
be rolled back as if they never happened.
|
||||
|
||||
|
||||
!SECTION Replacing documents
|
||||
Replacing documents
|
||||
-------------------
|
||||
|
||||
To not just partially update, but completely replace existing documents, use
|
||||
the *REPLACE* operation.
|
||||
|
@ -95,7 +98,8 @@ FOR u IN users
|
|||
```
|
||||
|
||||
|
||||
!SECTION Removing documents
|
||||
Removing documents
|
||||
------------------
|
||||
|
||||
Deleting documents can be achieved with the *REMOVE* operation.
|
||||
To remove all users within a certain age range, we can use the following query:
|
||||
|
@ -107,7 +111,8 @@ FOR u IN users
|
|||
```
|
||||
|
||||
|
||||
!SECTION Creating documents
|
||||
Creating documents
|
||||
------------------
|
||||
|
||||
To create new documents, there is the *INSERT* operation.
|
||||
It can also be used to generate copies of existing documents from other collections,
|
||||
|
@ -126,7 +131,8 @@ FOR i IN 1..1000
|
|||
```
|
||||
|
||||
|
||||
!SECTION Copying data from one collection into another
|
||||
Copying data from one collection into another
|
||||
---------------------------------------------
|
||||
|
||||
To copy data from one collection into another, an *INSERT* operation can be
|
||||
used:
|
||||
|
@ -147,7 +153,8 @@ To make such copy operation work in all cases, the target collection can
|
|||
be emptied before, using a *REMOVE* query.
|
||||
|
||||
|
||||
!SECTION Handling errors
|
||||
Handling errors
|
||||
---------------
|
||||
|
||||
In some cases it might be desirable to continue execution of a query even in
|
||||
the face of errors (e.g. "document not found"). To continue execution of a
|
||||
|
@ -165,7 +172,8 @@ This will continue execution of the query even if errors occur during the
|
|||
*REPLACE* operation. It works similar for *UPDATE*, *INSERT*, and *REMOVE*.
|
||||
|
||||
|
||||
!SECTION Altering substructures
|
||||
Altering substructures
|
||||
----------------------
|
||||
|
||||
To modify lists in documents we have to work with temporary variables.
|
||||
We will collect the sublist in there and alter it. We choose a simple
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
!CHAPTER Grouping
|
||||
Grouping
|
||||
========
|
||||
|
||||
To group results by arbitrary criteria, AQL provides the *COLLECT* keyword.
|
||||
*COLLECT* will perform a grouping, but no aggregation. Aggregation can still be
|
||||
added in the query if required.
|
||||
|
||||
!SUBSECTION Ensuring uniqueness
|
||||
### Ensuring uniqueness
|
||||
|
||||
*COLLECT* can be used to make a result set unique. The following query will return each distinct
|
||||
`age` attribute value only once:
|
||||
|
@ -36,7 +37,7 @@ FOR u IN users
|
|||
|
||||
Note: the order of results is undefined for *RETURN DISTINCT*.
|
||||
|
||||
!SUBSECTION Fetching group values
|
||||
### Fetching group values
|
||||
|
||||
To group users by age, and return the names of the users with the highest ages,
|
||||
we'll issue a query like this:
|
||||
|
@ -67,7 +68,7 @@ result document per distinct *age* value (let aside the *LIMIT*). For each group
|
|||
we have access to the matching document via the *usersByAge* variable introduced in
|
||||
the *COLLECT* statement.
|
||||
|
||||
!SUBSECTION Variable Expansion
|
||||
### Variable Expansion
|
||||
|
||||
The *usersByAge* variable contains the full documents found, and as we're only
|
||||
interested in user names, we'll use the expansion operator <i>[\*]</i> to extract just the
|
||||
|
@ -84,7 +85,7 @@ a subquery:
|
|||
( FOR temp IN usersByAge RETURN temp.u.name )
|
||||
```
|
||||
|
||||
!SUBSECTION Grouping by multiple criteria
|
||||
### Grouping by multiple criteria
|
||||
|
||||
To group by multiple criteria, we'll use multiple arguments in the *COLLECT* clause.
|
||||
For example, to group users by *ageGroup* (a derived value we need to calculate first)
|
||||
|
@ -113,7 +114,7 @@ FOR u IN users
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Counting group values
|
||||
### Counting group values
|
||||
|
||||
If the goal is to count the number of values in each group, AQL provides the special
|
||||
*COLLECT WITH COUNT INTO* syntax. This is a simple variant for grouping with an additional
|
||||
|
@ -143,7 +144,7 @@ FOR u IN users
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Aggregation
|
||||
### Aggregation
|
||||
|
||||
Adding further aggregation is also simple in AQL by using an *AGGREGATE* clause
|
||||
in the *COLLECT*:
|
||||
|
@ -200,7 +201,7 @@ in the collect operation. This is normally more efficient than collecting all gr
|
|||
for all groups and then doing a post-aggregation.
|
||||
|
||||
|
||||
!SUBSECTION Post-aggregation
|
||||
### Post-aggregation
|
||||
|
||||
Aggregation can also be performed after a *COLLECT* operation using other AQL constructs,
|
||||
though performance-wise this is often inferior to using *COLLECT* with *AGGREGATE*.
|
||||
|
@ -248,7 +249,7 @@ This is in constrast to the previous query that used an *AGGREGATE* clause to pe
|
|||
the aggregation during the collect operation, at the earliest possible stage.
|
||||
|
||||
|
||||
!SUBSECTION Post-filtering aggregated data
|
||||
### Post-filtering aggregated data
|
||||
|
||||
To filter the results of a grouping or aggregation operation (i.e. something
|
||||
similar to *HAVING* in SQL), simply add another *FILTER* clause after the *COLLECT*
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Joins
|
||||
Joins
|
||||
=====
|
||||
|
||||
So far we have only dealt with one collection (*users*) at a time. We also have a
|
||||
collection *relations* that stores relationships between users. We will now use
|
||||
|
@ -9,7 +10,7 @@ we'll use all *relations* that have a value of *friend* in their *type* attribut
|
|||
Relationships are established by using the *friendOf* and *thisUser* attributes in the
|
||||
*relations* collection, which point to the *userId* values in the *users* collection.
|
||||
|
||||
!SUBSECTION Join tuples
|
||||
### Join tuples
|
||||
|
||||
We'll start with a SQL-ish result set and return each tuple (user name, friends userId)
|
||||
separately. The AQL query to generate such result is:
|
||||
|
@ -70,7 +71,7 @@ by comparing the *userId* of our current user with the *friendOf* attribute of t
|
|||
and the userId of the friend.
|
||||
|
||||
|
||||
!SUBSECTION Horizontal lists
|
||||
### Horizontal lists
|
||||
|
||||
|
||||
Note that in the above result, a user can be returned multiple times. This is the
|
||||
|
@ -129,7 +130,7 @@ In this query we are still iterating over the users in the *users* collection
|
|||
and for each matching user we are executing a subquery to create the matching
|
||||
list of related users.
|
||||
|
||||
!SUBSECTION Self joins
|
||||
### Self joins
|
||||
|
||||
To not only return friend ids but also the names of friends, we could "join" the
|
||||
*users* collection once more (something like a "self join"):
|
||||
|
@ -188,7 +189,7 @@ friend from the users collection. So here we iterate the users collection,
|
|||
and for each hit the relations collection, and for each hit once more the
|
||||
users collection.
|
||||
|
||||
!SUBSECTION Outer joins
|
||||
### Outer joins
|
||||
|
||||
Lets find the lonely people in our database - those without friends.
|
||||
|
||||
|
@ -219,7 +220,7 @@ So, for each user we pick the list of their friends and count them. The ones whe
|
|||
count equals zero are the lonely people. Using *RETURN 1* in the subquery
|
||||
saves even more precious CPU cycles and gives the optimizer more alternatives.
|
||||
|
||||
!SUBSECTION Pitfalls
|
||||
### Pitfalls
|
||||
|
||||
Since we're free of schemata, there is by default no way to tell the format of the
|
||||
documents. So, if your documents don't contain an attribute, it defaults to
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER Projections and Filters
|
||||
Projections and Filters
|
||||
=======================
|
||||
|
||||
!SUBSECTION Returning unaltered documents
|
||||
### Returning unaltered documents
|
||||
|
||||
To return three complete documents from collection *users*, the following query can be used:
|
||||
|
||||
|
@ -49,7 +50,7 @@ Note that there is a *LIMIT* clause but no *SORT* clause. In this case it is not
|
|||
which of the user documents are returned. Effectively the document return order is unspecified
|
||||
if no *SORT* clause is used, and you should not rely on the order in such queries.
|
||||
|
||||
!SUBSECTION Projections
|
||||
### Projections
|
||||
|
||||
|
||||
To return a projection from the collection *users* use a modified *RETURN* instruction:
|
||||
|
@ -88,7 +89,7 @@ FOR u IN users
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Filters
|
||||
### Filters
|
||||
|
||||
To return a filtered projection from collection *users*, you can use the
|
||||
*FILTER* keyword. Additionally, a *SORT* clause is used to have the result
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Queries without collections
|
||||
Queries without collections
|
||||
===========================
|
||||
|
||||
|
||||
Following is a query that returns a string value. The result string is contained in an array
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Usual Query Patterns Examples
|
||||
Usual Query Patterns Examples
|
||||
=============================
|
||||
|
||||
Those pages contain some common query patterns with examples. For better
|
||||
understandability the query results are also included directly below each query.
|
||||
|
@ -9,7 +10,7 @@ will provide several examples for that.
|
|||
Some of the following example queries are executed on a collection 'users' with the data provided here below.
|
||||
|
||||
|
||||
!SUBSECTION Things to consider when running queries on collections
|
||||
### Things to consider when running queries on collections
|
||||
|
||||
Note that all documents created in any collections will automatically get the
|
||||
following server-generated attributes:
|
||||
|
@ -31,7 +32,7 @@ establishing references / links between documents. These features have been left
|
|||
for brevity as well.
|
||||
|
||||
|
||||
!SUBSECTION Example data
|
||||
### Example data
|
||||
|
||||
Some of the following example queries are executed on a collection *users*
|
||||
with the following initial data:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Explaining queries
|
||||
Explaining queries
|
||||
==================
|
||||
|
||||
If it is unclear how a given query will perform, clients can retrieve a query's execution plan
|
||||
from the AQL query optimizer without actually executing the query. Getting the query execution
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER The AQL query optimizer
|
||||
The AQL query optimizer
|
||||
=======================
|
||||
|
||||
AQL queries are sent through an optimizer before execution. The task of the optimizer is
|
||||
to create an initial execution plan for the query, look for optimization opportunities and
|
||||
|
@ -12,13 +13,13 @@ meaning that an optimization should not modify the result of a query. A notable
|
|||
to this is that the optimizer is allowed to change the order of results for queries that
|
||||
do not explicitly specify how results should be sorted.
|
||||
|
||||
!SUBSECTION Execution plans
|
||||
### Execution plans
|
||||
|
||||
The `explain` command can be used to query the optimal executed plan or even all plans
|
||||
the optimizer has generated. Additionally, `explain` can reveal some more information
|
||||
about the optimizer's view of the query.
|
||||
|
||||
!SUBSECTION Inspecting plans using the explain helper
|
||||
### Inspecting plans using the explain helper
|
||||
|
||||
The `explain` method of `ArangoStatement` as shown in the next chapters creates very verbose output.
|
||||
You can work on the output programmatically, or use this handsome tool that we created
|
||||
|
@ -38,7 +39,7 @@ You may use it like this: (we disable syntax highlighting here)
|
|||
@endDocuBlock AQLEXP_01_axplainer
|
||||
|
||||
|
||||
!SUBSECTION Execution plans in detail
|
||||
### Execution plans in detail
|
||||
|
||||
Let's have a look at the raw json output of the same execution plan
|
||||
using the `explain` method of `ArangoStatement`:
|
||||
|
@ -53,7 +54,7 @@ using the `explain` method of `ArangoStatement`:
|
|||
As you can see, the result details are very verbose so we will not show them in full in the next
|
||||
sections. Instead, let's take a closer look at the results step by step.
|
||||
|
||||
!SUBSUBSECTION Execution nodes
|
||||
#### Execution nodes
|
||||
|
||||
In general, an execution plan can be considered to be a pipeline of processing steps.
|
||||
Each processing step is carried out by a so-called *execution node*
|
||||
|
@ -104,7 +105,7 @@ Here's a summary:
|
|||
* ReturnNode: returns data to the caller
|
||||
|
||||
|
||||
!SUBSUBSECTION Optimizer rules
|
||||
#### Optimizer rules
|
||||
|
||||
Note that in the example, the optimizer has optimized the `SORT` statement away.
|
||||
It can do it safely because there is a sorted skiplist index on `i.value`, which it has
|
||||
|
@ -145,7 +146,7 @@ This is due to the same rule being applied multiple times, at different position
|
|||
in the optimizer pipeline.
|
||||
|
||||
|
||||
!SUBSUBSECTION Collections used in a query
|
||||
#### Collections used in a query
|
||||
|
||||
The list of collections used in a plan (and query) is contained in the `collections`
|
||||
attribute of a plan:
|
||||
|
@ -161,14 +162,14 @@ The `name` attribute contains the name of the `collection`, and `type` is the
|
|||
access type, which can be either `read` or `write`.
|
||||
|
||||
|
||||
!SUBSUBSECTION Variables used in a query
|
||||
#### Variables used in a query
|
||||
|
||||
The optimizer will also return a list of variables used in a plan (and query). This
|
||||
list will contain auxiliary variables created by the optimizer itself. This list
|
||||
can be ignored by end users in most cases.
|
||||
|
||||
|
||||
!SUBSUBSECTION Cost of a query
|
||||
#### Cost of a query
|
||||
|
||||
For each plan the optimizer generates, it will calculate the total cost. The plan
|
||||
with the lowest total cost is considered to be the optimal plan. Costs are
|
||||
|
@ -177,7 +178,7 @@ Costs are calculated based on heuristics that are hard-coded into execution node
|
|||
Cost values do not have any unit.
|
||||
|
||||
|
||||
!SUBSECTION Retrieving all execution plans
|
||||
### Retrieving all execution plans
|
||||
|
||||
To retrieve not just the optimal plan but a list of all plans the optimizer has
|
||||
generated, set the option `allPlans` to `true`:
|
||||
|
@ -192,7 +193,7 @@ This will return a list of all plans in the `plans` attribute instead of in the
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock AQLEXP_05_explainAllPlans
|
||||
|
||||
!SUBSECTION Retrieving the plan as it was generated by the parser / lexer
|
||||
### Retrieving the plan as it was generated by the parser / lexer
|
||||
|
||||
To retrieve the plan which closely matches your query, you may turn off most
|
||||
optimization rules (i.e. cluster rules cannot be disabled if you're running
|
||||
|
@ -211,7 +212,7 @@ Note that some optimizations are already done at parse time (i.e. evaluate simpl
|
|||
calculation as `1 + 1`)
|
||||
|
||||
|
||||
!SUBSECTION Turning specific optimizer rules off
|
||||
### Turning specific optimizer rules off
|
||||
|
||||
Optimizer rules can also be turned on or off individually, using the `rules` attribute.
|
||||
This can be used to enable or disable one or multiple rules. Rules that shall be enabled
|
||||
|
@ -248,7 +249,7 @@ The maximum number of plans created by the optimizer can also be limited using t
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock AQLEXP_09_explainMaxNumberOfPlans
|
||||
|
||||
!SUBSECTION Optimizer statistics
|
||||
### Optimizer statistics
|
||||
|
||||
The optimizer will return statistics as a part of an `explain` result.
|
||||
|
||||
|
@ -259,7 +260,7 @@ The following attributes will be returned in the `stats` attribute of an `explai
|
|||
indicate a plan was actually modified by a rule)
|
||||
- `rulesSkipped`: number of rules skipped by the optimizer
|
||||
|
||||
!SUBSECTION Warnings
|
||||
### Warnings
|
||||
|
||||
For some queries, the optimizer may produce warnings. These will be returned in
|
||||
the `warnings` attribute of the `explain` result:
|
||||
|
@ -277,7 +278,7 @@ There is an upper bound on the number of warning a query may produce. If that
|
|||
bound is reached, no further warnings will be returned.
|
||||
|
||||
|
||||
!SUBSECTION Things to consider for optimizing queries
|
||||
### Things to consider for optimizing queries
|
||||
While the optimizer can fix some things in queries, its not allowed to take some assumptions,
|
||||
that you, the user, knowing what queries are intended to do can take. It may pull calculations
|
||||
to the front of the execution, but it may not cross certain borders.
|
||||
|
@ -302,7 +303,7 @@ of the query, which will then only give us one V8 expression at the very start o
|
|||
|
||||
Next to bringing better performance, this also obeys the [DRY principle](https://en.wikipedia.org/wiki/Don't_repeat_yourself).
|
||||
|
||||
!SUBSECTION Optimization in a cluster
|
||||
### Optimization in a cluster
|
||||
|
||||
When you're running AQL in the cluster, the parsing of the query is done on the
|
||||
coordinator. The coordinator then chops the query into snipets, which are to
|
||||
|
@ -323,7 +324,7 @@ If in doubt, you should modify your query to reduce the number interconnections
|
|||
|
||||
When optimizing your query you may want to look at simpler parts of it first.
|
||||
|
||||
!SUBSECTION List of execution nodes
|
||||
### List of execution nodes
|
||||
|
||||
The following execution node types will appear in the output of `explain`:
|
||||
|
||||
|
@ -376,7 +377,7 @@ For queries in the cluster, the following nodes may appear in execution plans:
|
|||
So, all of the above cluster relevant nodes will be accompanied by a *RemoteNode*.
|
||||
|
||||
|
||||
!SUBSECTION List of optimizer rules
|
||||
### List of optimizer rules
|
||||
|
||||
The following optimizer rules may appear in the `rules` attribute of a plan:
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Parsing queries
|
||||
Parsing queries
|
||||
===============
|
||||
|
||||
Clients can use ArangoDB to check if a given AQL query is syntactically valid. ArangoDB provides
|
||||
an [HTTP REST API](../../HTTP/AqlQuery/index.html) for this.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER The AQL query result cache
|
||||
The AQL query result cache
|
||||
==========================
|
||||
|
||||
AQL provides an optional query result cache.
|
||||
|
||||
|
@ -10,7 +11,8 @@ The query cache is transparent so users do not need to manually invalidate
|
|||
results in it if underlying collection data are modified.
|
||||
|
||||
|
||||
!SECTION Modes
|
||||
Modes
|
||||
-----
|
||||
|
||||
The cache can be operated in the following modes:
|
||||
|
||||
|
@ -23,7 +25,8 @@ The cache can be operated in the following modes:
|
|||
The mode can be set at server startup and later changed at runtime.
|
||||
|
||||
|
||||
!SECTION Query eligibility
|
||||
Query eligibility
|
||||
-----------------
|
||||
|
||||
The query cache will consider two queries identical if they have exactly the
|
||||
same query string. Any deviation in terms of whitespace, capitalization etc.
|
||||
|
@ -62,7 +65,8 @@ The query cache considers all user-defined AQL functions to be non-deterministic
|
|||
as it has no insight into these functions.
|
||||
|
||||
|
||||
!SECTION Cache invalidation
|
||||
Cache invalidation
|
||||
------------------
|
||||
|
||||
The query cache results are fully or partially invalidated automatically if
|
||||
queries modify the data of collections that were used during the computation of
|
||||
|
@ -90,7 +94,8 @@ Modifying data in other collections than the named two will not lead to this
|
|||
query result being removed from the cache.
|
||||
|
||||
|
||||
!SECTION Performance considerations
|
||||
Performance considerations
|
||||
--------------------------
|
||||
|
||||
The query cache is organized as a hash table, so looking up whether a query result
|
||||
is present in the cache is relatively fast. Still, the query string and the bind
|
||||
|
@ -117,7 +122,8 @@ most of the query time is spent on copying the result from the cache to the clie
|
|||
then the cache will not provide much benefit.
|
||||
|
||||
|
||||
!SECTION Global configuration
|
||||
Global configuration
|
||||
--------------------
|
||||
|
||||
The query cache can be configured at server start using the configuration parameter
|
||||
`--query.cache-mode`. This will set the cache mode according to the descriptions
|
||||
|
@ -141,7 +147,8 @@ require("@arangodb/aql/cache").properties({ maxResults: 200 });
|
|||
```
|
||||
|
||||
|
||||
!SECTION Per-query configuration
|
||||
Per-query configuration
|
||||
-----------------------
|
||||
|
||||
When a query is sent to the server for execution and the cache is set to `on` or `demand`,
|
||||
the query executor will look into the query's `cache` attribute. If the query cache mode is
|
||||
|
@ -177,7 +184,8 @@ if the result was retrieved from the query cache, and `false` otherwise. Clients
|
|||
this attribute to check if a specific query was served from the cache or not.
|
||||
|
||||
|
||||
!SECTION Restrictions
|
||||
Restrictions
|
||||
------------
|
||||
|
||||
Query results that are returned from the query cache do not contain any execution statistics,
|
||||
meaning their *extra.stats* attribute will not be present. Additionally, query results returned
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Query statistics
|
||||
Query statistics
|
||||
================
|
||||
|
||||
A query that has been executed will always return execution statistics. Execution statistics
|
||||
can be retrieved by calling `getExtra()` on the cursor. The statistics are returned in the
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER AQL Execution and Performance
|
||||
AQL Execution and Performance
|
||||
=============================
|
||||
|
||||
This chapter describes AQL features related to query executions and query performance.
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Conventions
|
||||
Conventions
|
||||
===========
|
||||
|
||||
!SECTION Naming
|
||||
Naming
|
||||
------
|
||||
|
||||
Built-in AQL functions that are shipped with ArangoDB reside in the namespace
|
||||
*_aql*, which is also the default namespace to look in if an unqualified
|
||||
|
@ -21,7 +23,8 @@ fail.
|
|||
|
||||
User function names are case-insensitive like all function names in AQL.
|
||||
|
||||
!SECTION Variables and side effects
|
||||
Variables and side effects
|
||||
--------------------------
|
||||
|
||||
User functions can take any number of input arguments and should
|
||||
provide one result via a `return` statement. User functions should be kept
|
||||
|
@ -70,7 +73,8 @@ function (values) {
|
|||
}
|
||||
```
|
||||
|
||||
!SECTION Input parameters
|
||||
Input parameters
|
||||
----------------
|
||||
|
||||
In order to return a result, a user function should use a `return` instruction
|
||||
rather than modifying its input parameters.
|
||||
|
@ -82,7 +86,8 @@ However, user functions should not modify input parameters if the parameters are
|
|||
arrays or objects and as such passed by reference, as that may modify variables
|
||||
and state outside of the user function itself.
|
||||
|
||||
!SECTION Return values
|
||||
Return values
|
||||
-------------
|
||||
|
||||
User functions must only return primitive types (i.e. *null*, boolean
|
||||
values, numeric values, string values) or aggregate types (arrays or
|
||||
|
@ -90,7 +95,8 @@ objects) composed of these types.
|
|||
Returning any other JavaScript object type (Function, Date, RegExp etc.) from
|
||||
a user function may lead to undefined behavior and should be avoided.
|
||||
|
||||
!SECTION Enforcing strict mode
|
||||
Enforcing strict mode
|
||||
---------------------
|
||||
|
||||
By default, any user function code will be executed in *sloppy mode*, not
|
||||
*strict* or *strong mode*. In order to make a user function run in strict
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Registering and Unregistering User Functions
|
||||
Registering and Unregistering User Functions
|
||||
============================================
|
||||
|
||||
AQL user functions can be registered in the selected database
|
||||
using the *aqlfunctions* object as follows:
|
||||
|
@ -18,7 +19,7 @@ Otherwise you might see caching issues or accidentally break something.
|
|||
The interfaces will ensure the correct format of the documents and invalidate
|
||||
the UDF cache.
|
||||
|
||||
!SUBSECTION Registering an AQL user function
|
||||
### Registering an AQL user function
|
||||
|
||||
For testing, it may be sufficient to directly type the function code in the shell.
|
||||
To manage more complex code, you may write it in the code editor of your choice
|
||||
|
@ -136,7 +137,7 @@ expected number of arguments: minimum: 1, maximum: 1]
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION Deleting an existing AQL user function
|
||||
### Deleting an existing AQL user function
|
||||
|
||||
`aqlfunctions.unregister(name)`
|
||||
|
||||
|
@ -155,7 +156,7 @@ require("@arangodb/aql/functions").unregister("MYFUNCTIONS::TEMPERATURE::CELSIUS
|
|||
```
|
||||
|
||||
|
||||
!SUBSECTION Unregister Group
|
||||
### Unregister Group
|
||||
<!-- js/common/modules/@arangodb/aql/functions.js -->
|
||||
|
||||
|
||||
|
@ -178,7 +179,7 @@ require("@arangodb/aql/functions").unregisterGroup("MYFUNCTIONS");
|
|||
```
|
||||
|
||||
|
||||
!SUBSECTION Listing all AQL user functions
|
||||
### Listing all AQL user functions
|
||||
|
||||
`aqlfunctions.toArray()`
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Extending AQL with User Functions
|
||||
Extending AQL with User Functions
|
||||
=================================
|
||||
|
||||
AQL comes with a [built-in set of functions](../Functions/README.md), but it is
|
||||
not a fully-featured programming language.
|
||||
|
@ -12,9 +13,10 @@ all user defined functions (**UDF**) have to be put into separate namespaces.
|
|||
Invoking a UDF is then possible by referring to the fully-qualified function name,
|
||||
which includes the namespace, too; see [Conventions](Conventions.md).
|
||||
|
||||
!SECTION Technical Details
|
||||
Technical Details
|
||||
-----------------
|
||||
|
||||
!SUBSECTION Known Limitations
|
||||
### Known Limitations
|
||||
|
||||
**UDFs have some implications you should be aware of. Otherwise they can
|
||||
introduce serious effects on the performance of your queries and the resource
|
||||
|
@ -44,7 +46,7 @@ To overcome these mentioned limitations, you may want to
|
|||
and
|
||||
[the number of available server threads](../../Manual/Administration/Configuration/GeneralArangod.html#server-threads).
|
||||
|
||||
!SUBSECTION Deployment Details
|
||||
### Deployment Details
|
||||
|
||||
Internally, UDFs are stored in a system collection named `_aqlfunctions`
|
||||
of the selected database. When an AQL statement refers to such a UDF,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Array functions
|
||||
Array functions
|
||||
===============
|
||||
|
||||
AQL provides functions for higher-level array manipulation. Also see the
|
||||
[numeric functions](Numeric.md) for functions that work on number arrays.
|
||||
|
@ -18,7 +19,7 @@ Apart from that, AQL also offers several language constructs:
|
|||
as well as [COLLECT](../Operations/Collect.md) for grouping,
|
||||
which also offers efficient aggregation.
|
||||
|
||||
!SUBSECTION APPEND()
|
||||
### APPEND()
|
||||
|
||||
`APPEND(anyArray, values, unique) → newArray`
|
||||
|
||||
|
@ -39,11 +40,11 @@ APPEND([ 1, 2, 3 ], [ 3, 4, 5, 2, 9 ], true)
|
|||
// [ 1, 2, 3, 4, 5, 9 ]
|
||||
```
|
||||
|
||||
!SUBSECTION COUNT()
|
||||
### COUNT()
|
||||
|
||||
This is an alias for [LENGTH()](#length).
|
||||
|
||||
!SUBSECTION FIRST()
|
||||
### FIRST()
|
||||
|
||||
`FIRST(anyArray) → firstElement`
|
||||
|
||||
|
@ -53,7 +54,7 @@ Get the first element of an array. It is the same as `anyArray[0]`.
|
|||
- returns **firstElement** (any|null): the first element of *anyArray*, or *null* if
|
||||
the array is empty.
|
||||
|
||||
!SUBSECTION FLATTEN()
|
||||
### FLATTEN()
|
||||
|
||||
`FLATTEN(anyArray, depth) → flatArray`
|
||||
|
||||
|
@ -77,7 +78,7 @@ FLATTEN( [ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ] ], 2 )
|
|||
// [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
|
||||
```
|
||||
|
||||
!SUBSECTION INTERSECTION()
|
||||
### INTERSECTION()
|
||||
|
||||
`INTERSECTION(array1, array2, ... arrayN) → newArray`
|
||||
|
||||
|
@ -89,7 +90,7 @@ occur in all arguments.
|
|||
- returns **newArray** (array): a single array with only the elements, which exist in all
|
||||
provided arrays. The element order is random. Duplicates are removed.
|
||||
|
||||
!SUBSECTION LAST()
|
||||
### LAST()
|
||||
|
||||
`LAST(anyArray) → lastElement`
|
||||
|
||||
|
@ -99,7 +100,7 @@ Get the last element of an array. It is the same as `anyArray[-1]`.
|
|||
- returns **lastElement** (any|null): the last element of *anyArray* or *null* if the
|
||||
array is empty.
|
||||
|
||||
!SUBSECTION LENGTH()
|
||||
### LENGTH()
|
||||
|
||||
`LENGTH(anyArray) → length`
|
||||
|
||||
|
@ -112,7 +113,7 @@ Determine the number of elements in an array.
|
|||
of an object / document, the [amount of documents](Miscellaneous.md#length) in a
|
||||
collection and the [character length](String.md#length) of a string.
|
||||
|
||||
!SUBSECTION MINUS()
|
||||
### MINUS()
|
||||
|
||||
`MINUS(array1, array2, ... arrayN) → newArray`
|
||||
|
||||
|
@ -124,7 +125,7 @@ Return the difference of all arrays specified.
|
|||
but not in any of the subsequent arrays. The order of the result array is undefined
|
||||
and should not be relied on. Duplicates will be removed.
|
||||
|
||||
!SUBSECTION NTH()
|
||||
### NTH()
|
||||
|
||||
`NTH(anyArray, position) → nthElement`
|
||||
|
||||
|
@ -143,7 +144,7 @@ NTH( [ "foo", "bar", "baz" ], 3 ) // null
|
|||
NTH( [ "foo", "bar", "baz" ], -1 ) // null
|
||||
```
|
||||
|
||||
!SUBSECTION OUTERSECTION()
|
||||
### OUTERSECTION()
|
||||
|
||||
`OUTERSECTION(array1, array2, ... arrayN) → newArray`
|
||||
|
||||
|
@ -159,7 +160,7 @@ OUTERSECTION( [ 1, 2, 3 ], [ 2, 3, 4 ], [ 3, 4, 5 ] )
|
|||
// [ 1, 5 ]
|
||||
```
|
||||
|
||||
!SUBSECTION POP()
|
||||
### POP()
|
||||
|
||||
`POP(anyArray) → newArray`
|
||||
|
||||
|
@ -174,7 +175,7 @@ POP( [ 1, 2, 3, 4 ] ) // [ 1, 2, 3 ]
|
|||
POP( [ 1 ] ) // []
|
||||
```
|
||||
|
||||
!SUBSECTION POSITION()
|
||||
### POSITION()
|
||||
|
||||
`POSITION(anyArray, search, returnIndex) → position`
|
||||
|
||||
|
@ -188,7 +189,7 @@ Return whether *search* is contained in *array*. Optionally return the position.
|
|||
*false* otherwise. If *returnIndex* is enabled, the position of the match is
|
||||
returned (positions start at 0), or *-1* if it's not found.
|
||||
|
||||
!SUBSECTION PUSH()
|
||||
### PUSH()
|
||||
|
||||
`PUSH(anyArray, value, unique) → newArray`
|
||||
|
||||
|
@ -213,7 +214,7 @@ PUSH([ 1, 2, 2, 3 ], 2, true)
|
|||
// [ 1, 2, 2, 3 ]
|
||||
```
|
||||
|
||||
!SUBSECTION REMOVE_NTH()
|
||||
### REMOVE_NTH()
|
||||
|
||||
`REMOVE_NTH(anyArray, position) → newArray`
|
||||
|
||||
|
@ -233,7 +234,7 @@ REMOVE_NTH( [ "a", "b", "c", "d", "e" ], -2 )
|
|||
// [ "a", "b", "c", "e" ]
|
||||
```
|
||||
|
||||
!SUBSECTION REMOVE_VALUE()
|
||||
### REMOVE_VALUE()
|
||||
|
||||
`REMOVE_VALUE(anyArray, value, limit) → newArray`
|
||||
|
||||
|
@ -253,7 +254,7 @@ REMOVE_VALUE( [ "a", "b", "b", "a", "c" ], "a", 1 )
|
|||
// [ "b", "b", "a", "c" ]
|
||||
```
|
||||
|
||||
!SUBSECTION REMOVE_VALUES()
|
||||
### REMOVE_VALUES()
|
||||
|
||||
`REMOVE_VALUES(anyArray, values) → newArray`
|
||||
|
||||
|
@ -269,7 +270,7 @@ REMOVE_VALUES( [ "a", "a", "b", "c", "d", "e", "f" ], [ "a", "f", "d" ] )
|
|||
// [ "b", "c", "e" ]
|
||||
```
|
||||
|
||||
!SUBSECTION REVERSE()
|
||||
### REVERSE()
|
||||
|
||||
`REVERSE(anyArray) → reversedArray`
|
||||
|
||||
|
@ -279,7 +280,7 @@ Return an array with its elements reversed.
|
|||
- returns **reversedArray** (array): a new array with all elements of *anyArray* in
|
||||
reversed order
|
||||
|
||||
!SUBSECTION SHIFT()
|
||||
### SHIFT()
|
||||
|
||||
`SHIFT(anyArray) → newArray`
|
||||
|
||||
|
@ -294,7 +295,7 @@ SHIFT( [ 1, 2, 3, 4 ] ) // [ 2, 3, 4 ]
|
|||
SHIFT( [ 1 ] ) // []
|
||||
```
|
||||
|
||||
!SUBSECTION SLICE()
|
||||
### SLICE()
|
||||
|
||||
`SLICE(anyArray, start, length) → newArray`
|
||||
|
||||
|
@ -317,7 +318,7 @@ SLICE( [ 1, 2, 3, 4, 5 ], 0, -2 ) // [ 1, 2, 3 ]
|
|||
SLICE( [ 1, 2, 3, 4, 5 ], -3, 2 ) // [ 3, 4 ]
|
||||
```
|
||||
|
||||
!SUBSECTION UNION()
|
||||
### UNION()
|
||||
|
||||
`UNION(array1, array2, ... arrayN) → newArray`
|
||||
|
||||
|
@ -350,7 +351,7 @@ UNIQUE(
|
|||
// [ 1, 2, 3 ]
|
||||
```
|
||||
|
||||
!SUBSECTION UNION_DISTINCT()
|
||||
### UNION_DISTINCT()
|
||||
|
||||
`UNION_DISTINCT(array1, array2, ... arrayN) → newArray`
|
||||
|
||||
|
@ -369,7 +370,7 @@ UNION_DISTINCT(
|
|||
// [ 1, 2, 3 ]
|
||||
```
|
||||
|
||||
!SUBSECTION UNIQUE()
|
||||
### UNIQUE()
|
||||
|
||||
`UNIQUE(anyArray) → newArray`
|
||||
|
||||
|
@ -379,7 +380,7 @@ function will use the comparison order.
|
|||
- **anyArray** (array): array with elements of arbitrary type
|
||||
- returns **newArray** (array): *anyArray* without duplicates, in any order
|
||||
|
||||
!SUBSECTION UNSHIFT()
|
||||
### UNSHIFT()
|
||||
|
||||
`UNSHIFT(anyArray, value, unique) → newArray`
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Date functions
|
||||
Date functions
|
||||
==============
|
||||
|
||||
AQL offers functionality to work with dates. Dates are no data types of their own in
|
||||
AQL (neither are they in JSON, which is usually used as format to ship data into and
|
||||
|
@ -41,9 +42,10 @@ most certainly not be of any help for such dates, but you can still use language
|
|||
constructs like [SORT](../Operations/Sort.md) (which also supports sorting of arrays)
|
||||
and [indexes](../../Manual/Indexing/index.html) like skiplists.
|
||||
|
||||
!SECTION Current date and time
|
||||
Current date and time
|
||||
---------------------
|
||||
|
||||
!SUBSECTION DATE_NOW()
|
||||
### DATE_NOW()
|
||||
|
||||
`DATE_NOW() → timestamp`
|
||||
|
||||
|
@ -57,7 +59,8 @@ Note that this function is evaluated on every invocation and may return
|
|||
different values when invoked multiple times in the same query. Assign it
|
||||
to a variable to use the exact same timestamp multiple times.
|
||||
|
||||
!SECTION Conversion
|
||||
Conversion
|
||||
----------
|
||||
|
||||
*DATE_TIMESTAMP()* and *DATE_ISO8601()* can be used to convert ISO 8601 date time
|
||||
strings to numeric timestamps and numeric timestamps to ISO 8601 date time strings.
|
||||
|
@ -101,7 +104,7 @@ DATE_ISO8601(1399472349522)
|
|||
|
||||
The above functions are all equivalent and will return *"2014-05-07T14:19:09.522Z"*.
|
||||
|
||||
!SUBSECTION DATE_ISO8601()
|
||||
### DATE_ISO8601()
|
||||
|
||||
`DATE_ISO8601(date) → dateString`
|
||||
|
||||
|
@ -126,7 +129,7 @@ date components separately. All parameters after *day* are optional.
|
|||
- **milliseconds** (number, *optional*): 0..999
|
||||
- returns **dateString**: date and time expressed according to ISO 8601, in Zulu time
|
||||
|
||||
!SUBSECTION DATE_TIMESTAMP()
|
||||
### DATE_TIMESTAMP()
|
||||
|
||||
`DATE_TIMESTAMP(date) → timestamp`
|
||||
|
||||
|
@ -161,7 +164,7 @@ DATE_TIMESTAMP(2016, 2, 32) // returns 1456963200000, which is March 3rd, 2016
|
|||
DATE_TIMESTAMP(1970, 1, 1, 26) // returns 93600000, which is January 2nd, 1970, at 2 a.m.
|
||||
```
|
||||
|
||||
!SUBSECTION IS_DATESTRING()
|
||||
### IS_DATESTRING()
|
||||
|
||||
`IS_DATESTRING(value) → bool`
|
||||
|
||||
|
@ -174,9 +177,10 @@ Check if an arbitrary string is suitable for interpretation as date time string.
|
|||
*false* for all non-string values, even if some of them may be usable in date
|
||||
functions.
|
||||
|
||||
!SECTION Processing
|
||||
Processing
|
||||
----------
|
||||
|
||||
!SUBSECTION DATE_DAYOFWEEK()
|
||||
### DATE_DAYOFWEEK()
|
||||
|
||||
`DATE_DAYOFWEEK(date) → weekdayNumber`
|
||||
|
||||
|
@ -192,7 +196,7 @@ Return the weekday number of *date*.
|
|||
- 5 – Friday
|
||||
- 6 – Saturday
|
||||
|
||||
!SUBSECTION DATE_YEAR()
|
||||
### DATE_YEAR()
|
||||
|
||||
`DATE_YEAR(date) → year`
|
||||
|
||||
|
@ -201,7 +205,7 @@ Return the year of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **year** (number): the year part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_MONTH()
|
||||
### DATE_MONTH()
|
||||
|
||||
`DATE_MONTH(date) → month`
|
||||
|
||||
|
@ -210,7 +214,7 @@ Return the month of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **month** (number): the month part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_DAY()
|
||||
### DATE_DAY()
|
||||
|
||||
`DATE_DAY(date) → day`
|
||||
|
||||
|
@ -219,7 +223,7 @@ Return the day of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **day** (number): the day part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_HOUR()
|
||||
### DATE_HOUR()
|
||||
|
||||
Return the hour of *date*.
|
||||
|
||||
|
@ -228,7 +232,7 @@ Return the hour of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **hour** (number): the hour part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_MINUTE()
|
||||
### DATE_MINUTE()
|
||||
|
||||
`DATE_MINUTE(date) → minute`
|
||||
|
||||
|
@ -237,7 +241,7 @@ Return the minute of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **minute** (number): the minute part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_SECOND()
|
||||
### DATE_SECOND()
|
||||
|
||||
`DATE_SECOND(date) → second`
|
||||
|
||||
|
@ -246,14 +250,14 @@ Return the second of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **second** (number): the seconds part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_MILLISECOND()
|
||||
### DATE_MILLISECOND()
|
||||
|
||||
`DATE_MILLISECOND(date) → millisecond`
|
||||
|
||||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **millisecond** (number): the milliseconds part of *date* as a number
|
||||
|
||||
!SUBSECTION DATE_DAYOFYEAR()
|
||||
### DATE_DAYOFYEAR()
|
||||
|
||||
`DATE_DAYOFYEAR(date) → dayOfYear`
|
||||
|
||||
|
@ -263,7 +267,7 @@ Return the day of year of *date*.
|
|||
- returns **dayOfYear** (number): the day of year number of *date*.
|
||||
The return values range from 1 to 365, or 366 in a leap year respectively.
|
||||
|
||||
!SUBSECTION DATE_ISOWEEK()
|
||||
### DATE_ISOWEEK()
|
||||
|
||||
`DATE_ISOWEEK(date) → weekDate`
|
||||
|
||||
|
@ -276,7 +280,7 @@ Return the week date of *date* according to ISO 8601.
|
|||
the next year, and the first days in January may be part of the previous year's
|
||||
last week.
|
||||
|
||||
!SUBSECTION DATE_LEAPYEAR()
|
||||
### DATE_LEAPYEAR()
|
||||
|
||||
`DATE_LEAPYEAR(date) → leapYear`
|
||||
|
||||
|
@ -285,7 +289,7 @@ Return whether *date* is in a leap year.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **leapYear** (bool): *true* if *date* is in a leap year, *false* otherwise
|
||||
|
||||
!SUBSECTION DATE_QUARTER()
|
||||
### DATE_QUARTER()
|
||||
|
||||
`DATE_QUARTER(date) → quarter`
|
||||
|
||||
|
@ -298,7 +302,7 @@ Return which quarter *date* belongs to.
|
|||
- 3 – July, August, September
|
||||
- 4 – October, November, December
|
||||
|
||||
!SUBSECTION DATE_DAYS_IN_MONTH()
|
||||
### DATE_DAYS_IN_MONTH()
|
||||
|
||||
Return the number of days in the month of *date*.
|
||||
|
||||
|
@ -307,7 +311,7 @@ Return the number of days in the month of *date*.
|
|||
- **date** (number|string): numeric timestamp or ISO 8601 date time string
|
||||
- returns **daysInMonth** (number): the number of days in *date*'s month (28..31)
|
||||
|
||||
!SUBSECTION DATE_FORMAT()
|
||||
### DATE_FORMAT()
|
||||
|
||||
`DATE_FORMAT(date, format) → str`
|
||||
|
||||
|
@ -379,9 +383,10 @@ DATE_FORMAT("2016", "%%l = %l") // "%l = 1" (2016 is a leap year)
|
|||
DATE_FORMAT("2016-03-01", "%xxx%") // "063", trailing % ignored
|
||||
```
|
||||
|
||||
!SECTION Comparison and calculation
|
||||
Comparison and calculation
|
||||
--------------------------
|
||||
|
||||
!SUBSECTION DATE_ADD()
|
||||
### DATE_ADD()
|
||||
|
||||
`DATE_ADD(date, amount, unit) → isoDate`
|
||||
|
||||
|
@ -444,7 +449,7 @@ DATE_ADD("2000-01-01", "PT30M44.4S" // add 30 minutes, 44 seconds and 400 ms
|
|||
DATE_ADD("2000-01-01", "P1Y2M3W4DT5H6M7.89S" // add a bit of everything
|
||||
```
|
||||
|
||||
!SUBSECTION DATE_SUBTRACT()
|
||||
### DATE_SUBTRACT()
|
||||
|
||||
`DATE_SUBTRACT(date, amount, unit) → isoDate`
|
||||
|
||||
|
@ -503,7 +508,7 @@ DATE_SUBTRACT(DATE_NOW(), "P4D") // four days ago
|
|||
DATE_SUBTRACT(DATE_NOW(), "PT1H3M") // 1 hour and 30 minutes ago
|
||||
```
|
||||
|
||||
!SUBSECTION DATE_DIFF()
|
||||
### DATE_DIFF()
|
||||
|
||||
`DATE_DIFF(date1, date2, unit, asFloat) → diff`
|
||||
|
||||
|
@ -527,7 +532,7 @@ with decimal places.
|
|||
- returns **diff** (number): the calculated difference as number in *unit*.
|
||||
The value will be negative if *date2* is before *date1*.
|
||||
|
||||
!SUBSECTION DATE_COMPARE()
|
||||
### DATE_COMPARE()
|
||||
|
||||
`DATE_COMPARE(date1, date2, unitRangeStart, unitRangeEnd) → bool`
|
||||
|
||||
|
@ -614,7 +619,8 @@ FOR user IN users
|
|||
RETURN user
|
||||
```
|
||||
|
||||
!SECTION Working with dates and indices
|
||||
Working with dates and indices
|
||||
------------------------------
|
||||
|
||||
There are two recommended ways to store timestamps in ArangoDB:
|
||||
- as string with [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) UTC timestamp
|
||||
|
@ -641,7 +647,8 @@ skiplist indices:
|
|||
|
||||
The first and the last timestamp in the array are excluded from the result by the `FILTER`.
|
||||
|
||||
!SECTION Limitations
|
||||
Limitations
|
||||
-----------
|
||||
|
||||
Note that dates before the year 1583 aren't allowed by the
|
||||
[ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) standard by default, because
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
!CHAPTER Document functions
|
||||
Document functions
|
||||
==================
|
||||
|
||||
AQL provides below listed functions to operate on objects / document values.
|
||||
Also see [object access](../Fundamentals/DataTypes.md#objects--documents) for
|
||||
additional language constructs.
|
||||
|
||||
!SUBSECTION ATTRIBUTES()
|
||||
### ATTRIBUTES()
|
||||
|
||||
`ATTRIBUTES(document, removeInternal, sort) → strArray`
|
||||
|
||||
|
@ -45,11 +46,11 @@ FOR attributeArray IN attributesPerDocument
|
|||
RETURN {attr, count}
|
||||
```
|
||||
|
||||
!SUBSECTION COUNT()
|
||||
### COUNT()
|
||||
|
||||
This is an alias for [LENGTH()](#length).
|
||||
|
||||
!SUBSECTION HAS()
|
||||
### HAS()
|
||||
|
||||
`HAS(document, attributeName) → isPresent`
|
||||
|
||||
|
@ -92,7 +93,7 @@ FILTER IS_NULL(doc, "name") // can not use indexes
|
|||
FILTER doc.name == null // can utilize non-sparse indexes
|
||||
```
|
||||
|
||||
!SUBSECTION IS_SAME_COLLECTION()
|
||||
### IS_SAME_COLLECTION()
|
||||
|
||||
`IS_SAME_COLLECTION(collectionName, documentHandle) → bool`
|
||||
|
||||
|
@ -121,7 +122,7 @@ IS_SAME_COLLECTION( "_users", "foobar/baz")
|
|||
IS_SAME_COLLECTION( "_users", { _id: "something/else" } )
|
||||
```
|
||||
|
||||
!SUBSECTION KEEP()
|
||||
### KEEP()
|
||||
|
||||
`KEEP(document, attributeName1, attributeName2, ... attributeNameN) → doc`
|
||||
|
||||
|
@ -149,7 +150,7 @@ KEEP(doc, "firstname", "name", "likes")
|
|||
KEEP(doc, [ "firstname", "name", "likes" ])
|
||||
```
|
||||
|
||||
!SUBSECTION LENGTH()
|
||||
### LENGTH()
|
||||
|
||||
`LENGTH(doc) → attrCount`
|
||||
|
||||
|
@ -163,7 +164,7 @@ Determine the number of attribute keys of an object / document.
|
|||
the [amount of documents](Miscellaneous.md#length) in a collection and
|
||||
the [character length](String.md#length) of a string.
|
||||
|
||||
!SUBSECTION MATCHES()
|
||||
### MATCHES()
|
||||
|
||||
`MATCHES(document, examples, returnIndex) → match`
|
||||
|
||||
|
@ -211,7 +212,7 @@ RETURN MATCHES(
|
|||
This will return *2*, because the third example matches, and because the
|
||||
*returnIndex* flag is set to *true*.
|
||||
|
||||
!SUBSECTION MERGE()
|
||||
### MERGE()
|
||||
|
||||
`MERGE(document1, document2, ... documentN) → mergedDocument`
|
||||
|
||||
|
@ -277,7 +278,7 @@ This will now return:
|
|||
}
|
||||
```
|
||||
|
||||
!SUBSECTION MERGE_RECURSIVE()
|
||||
### MERGE_RECURSIVE()
|
||||
|
||||
`MERGE_RECURSIVE(document1, document2, ... documentN) → mergedDocument`
|
||||
|
||||
|
@ -301,7 +302,7 @@ MERGE_RECURSIVE(
|
|||
|
||||
*MERGE_RECURSIVE()* does not support the single array parameter variant that *MERGE* offers.
|
||||
|
||||
!SUBSECTION PARSE_IDENTIFIER()
|
||||
### PARSE_IDENTIFIER()
|
||||
|
||||
`PARSE_IDENTIFIER(documentHandle) → parts`
|
||||
|
||||
|
@ -324,7 +325,7 @@ PARSE_IDENTIFIER( { "_id": "mycollection/mykey", "value": "some value" } )
|
|||
// { "collection": "mycollection", "key": "mykey" }
|
||||
```
|
||||
|
||||
!SUBSECTION TRANSLATE()
|
||||
### TRANSLATE()
|
||||
|
||||
`TRANSLATE(value, lookupDocument, defaultValue) → mappedValue`
|
||||
|
||||
|
@ -350,7 +351,7 @@ TRANSLATE(42, { foo: "bar", bar: "baz" }, "not found!")
|
|||
// "not found!"
|
||||
```
|
||||
|
||||
!SUBSECTION UNSET()
|
||||
### UNSET()
|
||||
|
||||
`UNSET(document, attributeName1, attributeName2, ... attributeNameN) → doc`
|
||||
|
||||
|
@ -378,7 +379,7 @@ UNSET( doc, "_id", "_key", "foo", "bar" )
|
|||
UNSET( doc, [ "_id", "_key", "foo", "bar" ] )
|
||||
```
|
||||
|
||||
!SUBSECTION UNSET_RECURSIVE()
|
||||
### UNSET_RECURSIVE()
|
||||
|
||||
`UNSET_RECURSIVE(document, attributeName1, attributeName2, ... attributeNameN) → doc`
|
||||
|
||||
|
@ -406,7 +407,7 @@ UNSET_RECURSIVE( doc, "_id", "_key", "foo", "bar" )
|
|||
UNSET_RECURSIVE( doc, [ "_id", "_key", "foo", "bar" ] )
|
||||
```
|
||||
|
||||
!SUBSECTION VALUES()
|
||||
### VALUES()
|
||||
|
||||
`VALUES(document, removeInternal) → anyArray`
|
||||
|
||||
|
@ -426,7 +427,7 @@ VALUES( { "_key": "users/jane", "name": "Jane", "age": 35 }, true )
|
|||
// [ "Jane", 35 ]
|
||||
```
|
||||
|
||||
!SUBSECTION ZIP()
|
||||
### ZIP()
|
||||
|
||||
`ZIP(keys, values) → doc`
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
!CHAPTER Fulltext functions
|
||||
Fulltext functions
|
||||
==================
|
||||
|
||||
AQL offers the following functions to filter data based on
|
||||
[fulltext indexes](../../Manual/Indexing/Fulltext.html):
|
||||
|
||||
!SUBSECTION FULLTEXT()
|
||||
### FULLTEXT()
|
||||
|
||||
`FULLTEXT(coll, attribute, query, limit) → docArray`
|
||||
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
!CHAPTER Geo functions
|
||||
Geo functions
|
||||
=============
|
||||
|
||||
!SECTION Geo index functions
|
||||
Geo index functions
|
||||
-------------------
|
||||
|
||||
AQL offers the following functions to filter data based on
|
||||
[geo indexes](../../Manual/Indexing/Geo.html). These functions require the collection to have at
|
||||
least one geo index. If no geo index can be found, calling this function will fail
|
||||
with an error at runtime. There is no error when explaining the query however.
|
||||
|
||||
!SUBSECTION NEAR()
|
||||
### NEAR()
|
||||
|
||||
`NEAR(coll, latitude, longitude, limit, distanceName) → docArray`
|
||||
|
||||
|
@ -32,7 +34,7 @@ The result documents will contain the distance value in an attribute of that nam
|
|||
- returns **docArray** (array): an array of documents, sorted by distance (shortest
|
||||
distance first)
|
||||
|
||||
!SUBSECTION WITHIN()
|
||||
### WITHIN()
|
||||
|
||||
`WITHIN(coll, latitude, longitude, radius, distanceName) → docArray`
|
||||
|
||||
|
@ -53,7 +55,7 @@ The result documents will contain the distance value in an attribute of that nam
|
|||
- returns **docArray** (array): an array of documents, sorted by distance (shortest
|
||||
distance first)
|
||||
|
||||
!SUBSECTION WITHIN_RECTANGLE()
|
||||
### WITHIN_RECTANGLE()
|
||||
|
||||
`WITHIN_RECTANGLE(coll, latitude1, longitude1, latitude2, longitude2) → docArray`
|
||||
|
||||
|
@ -68,14 +70,15 @@ There is no guaranteed order in which the documents are returned.
|
|||
- **longitude2** (number): the top-right longitude portion of the search coordinate
|
||||
- returns **docArray** (array): an array of documents, in random order
|
||||
|
||||
!SECTION Geo utility functions
|
||||
Geo utility functions
|
||||
---------------------
|
||||
|
||||
The following helper functions do **not use any geo index**. On large datasets,
|
||||
it is advisable to use them in combination with index-accelerated geo functions
|
||||
to limit the number of calls to these non-accelerated functions because of their
|
||||
computational costs.
|
||||
|
||||
!SUBSECTION DISTANCE()
|
||||
### DISTANCE()
|
||||
|
||||
`DISTANCE(latitude1, longitude1, latitude2, longitude2) → distance`
|
||||
|
||||
|
@ -100,7 +103,7 @@ FOR doc IN documentSubset // e.g. documents returned by a traversal
|
|||
RETURN doc
|
||||
```
|
||||
|
||||
!SUBSECTION IS_IN_POLYGON()
|
||||
### IS_IN_POLYGON()
|
||||
|
||||
Determine whether a coordinate is inside a polygon.
|
||||
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
!CHAPTER Miscellaneous functions
|
||||
Miscellaneous functions
|
||||
=======================
|
||||
|
||||
!SECTION Control flow functions
|
||||
Control flow functions
|
||||
----------------------
|
||||
|
||||
!SUBSECTION NOT_NULL()
|
||||
### NOT_NULL()
|
||||
|
||||
`NOT_NULL(alternative, ...) → value`
|
||||
|
||||
|
@ -13,7 +15,7 @@ are *null* themselves. It is also known as `COALESCE()` in SQL.
|
|||
- returns **value** (any): first non-null parameter, or *null* if all arguments
|
||||
are *null*
|
||||
|
||||
!SUBSECTION FIRST_LIST()
|
||||
### FIRST_LIST()
|
||||
|
||||
Return the first alternative that is an array, and *null* if none of the
|
||||
alternatives is an array.
|
||||
|
@ -21,7 +23,7 @@ alternatives is an array.
|
|||
- **alternative** (any, *repeatable*): input of arbitrary type
|
||||
- returns **list** (list|null): array / list or null
|
||||
|
||||
!SUBSECTION FIRST_DOCUMENT()
|
||||
### FIRST_DOCUMENT()
|
||||
|
||||
`FIRST_DOCUMENT(value) → doc`
|
||||
|
||||
|
@ -31,21 +33,22 @@ alternatives is a document.
|
|||
- **alternative** (any, *repeatable*): input of arbitrary type
|
||||
- returns **doc** (object|null): document / object or null
|
||||
|
||||
!SUBSECTION Ternary operator
|
||||
### Ternary operator
|
||||
|
||||
For conditional evaluation, check out the
|
||||
[ternary operator](../Operators.md#ternary-operator).
|
||||
|
||||
!SECTION Database functions
|
||||
Database functions
|
||||
------------------
|
||||
|
||||
!SUBSECTION COLLECTION_COUNT()
|
||||
### COLLECTION_COUNT()
|
||||
|
||||
`COLLECTION_COUNT(coll) → count`
|
||||
|
||||
Determine the amount of documents in a collection. [LENGTH()](#length)
|
||||
is preferred.
|
||||
|
||||
!SUBSECTION COLLECTIONS()
|
||||
### COLLECTIONS()
|
||||
|
||||
`COLLECTIONS() → docArray`
|
||||
|
||||
|
@ -54,11 +57,11 @@ Return an array of collections.
|
|||
- returns **docArray** (array): each collection as a document with attributes
|
||||
*name* and *_id* in an array
|
||||
|
||||
!SUBSECTION COUNT()
|
||||
### COUNT()
|
||||
|
||||
This is an alias for [LENGTH()](#length).
|
||||
|
||||
!SUBSECTION CURRENT_USER()
|
||||
### CURRENT_USER()
|
||||
|
||||
`CURRENT_USER() → userName`
|
||||
|
||||
|
@ -72,7 +75,7 @@ a request context. Otherwise, the return value of this function will be *null*.
|
|||
- returns **userName** (string|null): the current user name, or *null* if
|
||||
authentication is disabled
|
||||
|
||||
!SUBSECTION DOCUMENT()
|
||||
### DOCUMENT()
|
||||
|
||||
`DOCUMENT(collection, id) → doc`
|
||||
|
||||
|
@ -120,7 +123,7 @@ DOCUMENT("users/john")
|
|||
DOCUMENT( [ "users/john", "users/amy" ] )
|
||||
```
|
||||
|
||||
!SUBSECTION LENGTH()
|
||||
### LENGTH()
|
||||
|
||||
`LENGTH(coll) → documentCount`
|
||||
|
||||
|
@ -135,7 +138,8 @@ It calls [COLLECTION_COUNT()](#collectioncount) internally.
|
|||
the [number of attribute keys](Document.md#length) of an object / document and
|
||||
the [character length](String.md#length) of a string.
|
||||
|
||||
!SECTION Hash functions
|
||||
Hash functions
|
||||
--------------
|
||||
|
||||
`HASH(value) → hashNumber`
|
||||
|
||||
|
@ -158,9 +162,10 @@ guaranteed to remain the same in future versions of ArangoDB. The hash values
|
|||
should therefore be used only for temporary calculations, e.g. to compare if two
|
||||
documents are the same, or for grouping values in queries.
|
||||
|
||||
!SECTION Function calling
|
||||
Function calling
|
||||
----------------
|
||||
|
||||
!SUBSECTION APPLY()
|
||||
### APPLY()
|
||||
|
||||
`APPLY(functionName, arguments) → retVal`
|
||||
|
||||
|
@ -179,7 +184,7 @@ APPLY( "SUBSTRING", [ "this is a test", 0, 7 ] )
|
|||
// "this is"
|
||||
```
|
||||
|
||||
!SUBSECTION CALL()
|
||||
### CALL()
|
||||
|
||||
`CALL(funcName, arg1, arg2, ... argN) → retVal`
|
||||
|
||||
|
@ -199,13 +204,14 @@ CALL( "SUBSTRING", "this is a test", 0, 4 )
|
|||
// "this"
|
||||
```
|
||||
|
||||
!SECTION Internal functions
|
||||
Internal functions
|
||||
------------------
|
||||
|
||||
The following functions are used during development of ArangoDB as a database
|
||||
system, primarily for unit testing. They are not intended to be used by end
|
||||
users, especially not in production environments.
|
||||
|
||||
!SUBSECTION FAIL()
|
||||
### FAIL()
|
||||
|
||||
`FAIL(reason)`
|
||||
|
||||
|
@ -222,7 +228,7 @@ RETURN 1 == 2 && FAIL("error") ? true : false // false
|
|||
RETURN 1 == 1 && FAIL("error") ? true : false // aborted with error
|
||||
```
|
||||
|
||||
!SUBSECTION NOOPT()
|
||||
### NOOPT()
|
||||
|
||||
`NOOPT(expression) → retVal`
|
||||
|
||||
|
@ -244,7 +250,7 @@ NOOPT( RAND() ) // C++ implementation
|
|||
V8( RAND() ) // JavaScript implementation
|
||||
```
|
||||
|
||||
!SUBSECTION PASSTHRU()
|
||||
### PASSTHRU()
|
||||
|
||||
`PASSTHRU(value) → retVal`
|
||||
|
||||
|
@ -254,7 +260,7 @@ query optimization.
|
|||
- **value** (any): a value of arbitrary type
|
||||
- returns **retVal** (any): *value*, without optimizations
|
||||
|
||||
!SUBSECTION SLEEP()
|
||||
### SLEEP()
|
||||
|
||||
`SLEEP(seconds) → null`
|
||||
|
||||
|
@ -268,7 +274,7 @@ SLEEP(1) // wait 1 second
|
|||
SLEEP(0.02) // wait 20 milliseconds
|
||||
```
|
||||
|
||||
!SUBSECTION V8()
|
||||
### V8()
|
||||
|
||||
`V8(expression) → retVal`
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
!CHAPTER Numeric functions
|
||||
Numeric functions
|
||||
=================
|
||||
|
||||
AQL offers some numeric functions for calculations. The following functions are
|
||||
supported:
|
||||
|
||||
!SUBSECTION ABS()
|
||||
### ABS()
|
||||
|
||||
`ABS(value) → unsignedValue`
|
||||
|
||||
|
@ -18,7 +19,7 @@ ABS(+5) // 5
|
|||
ABS(3.5) // 3.5
|
||||
```
|
||||
|
||||
!SUBSECTION ACOS()
|
||||
### ACOS()
|
||||
|
||||
`ACOS(value) → num`
|
||||
|
||||
|
@ -35,7 +36,7 @@ ACOS(1) // 0
|
|||
ACOS(2) // null
|
||||
```
|
||||
|
||||
!SUBSECTION ASIN()
|
||||
### ASIN()
|
||||
|
||||
`ASIN(value) → num`
|
||||
|
||||
|
@ -52,7 +53,7 @@ ASIN(-1) // -1.5707963267948966
|
|||
ASIN(2) // null
|
||||
```
|
||||
|
||||
!SUBSECTION ATAN()
|
||||
### ATAN()
|
||||
|
||||
`ATAN(value) → num`
|
||||
|
||||
|
@ -67,7 +68,7 @@ ATAN(0) // 0
|
|||
ATAN(10) // 1.4711276743037347
|
||||
```
|
||||
|
||||
!SUBSECTION ATAN2()
|
||||
### ATAN2()
|
||||
|
||||
`ATAN2(y, x) → num`
|
||||
|
||||
|
@ -80,7 +81,7 @@ ATAN2(1, 1) // 0.7853981633974483
|
|||
ATAN2(-10, 20) // -0.4636476090008061
|
||||
```
|
||||
|
||||
!SUBSECTION AVERAGE()
|
||||
### AVERAGE()
|
||||
|
||||
`AVERAGE(numArray) → mean`
|
||||
|
||||
|
@ -96,7 +97,7 @@ AVERAGE( [ -3, -5, 2 ] ) // -2
|
|||
AVERAGE( [ 999, 80, 4, 4, 4, 3, 3, 3 ] ) // 137.5
|
||||
```
|
||||
|
||||
!SUBSECTION CEIL()
|
||||
### CEIL()
|
||||
|
||||
`CEIL(value) → roundedValue`
|
||||
|
||||
|
@ -112,7 +113,7 @@ CEIL(-2.50) // -2
|
|||
CEIL(-2.51) // -2
|
||||
```
|
||||
|
||||
!SUBSECTION COS()
|
||||
### COS()
|
||||
|
||||
`COS(value) → num`
|
||||
|
||||
|
@ -128,7 +129,7 @@ COS(-3.141592653589783) // -1
|
|||
COS(RADIANS(45)) // 0.7071067811865476
|
||||
```
|
||||
|
||||
!SUBSECTION DEGREES()
|
||||
### DEGREES()
|
||||
|
||||
`DEGREES(rad) → num`
|
||||
|
||||
|
@ -143,7 +144,7 @@ DEGREES(0) // 0
|
|||
DEGREES(3.141592653589793) // 180
|
||||
```
|
||||
|
||||
!SUBSECTION EXP()
|
||||
### EXP()
|
||||
|
||||
`EXP(value) → num`
|
||||
|
||||
|
@ -158,7 +159,7 @@ EXP(10) // 22026.46579480671
|
|||
EXP(0) // 1
|
||||
```
|
||||
|
||||
!SUBSECTION EXP2()
|
||||
### EXP2()
|
||||
|
||||
`EXP2(value) → num`
|
||||
|
||||
|
@ -173,7 +174,7 @@ EXP2(1) // 2
|
|||
EXP2(0) // 1
|
||||
```
|
||||
|
||||
!SUBSECTION FLOOR()
|
||||
### FLOOR()
|
||||
|
||||
`FLOOR(value) → roundedValue`
|
||||
|
||||
|
@ -189,7 +190,7 @@ FLOOR(-2.50) // -3
|
|||
FLOOR(-2.51) // -3
|
||||
```
|
||||
|
||||
!SUBSECTION LOG()
|
||||
### LOG()
|
||||
|
||||
`LOG(value) → num`
|
||||
|
||||
|
@ -206,7 +207,7 @@ LOG(10) // 2.302585092994046
|
|||
LOG(0) // null
|
||||
```
|
||||
|
||||
!SUBSECTION LOG2()
|
||||
### LOG2()
|
||||
|
||||
`LOG2(value) → num`
|
||||
|
||||
|
@ -222,7 +223,7 @@ LOG2(8) // 3
|
|||
LOG2(0) // null
|
||||
```
|
||||
|
||||
!SUBSECTION LOG10()
|
||||
### LOG10()
|
||||
|
||||
`LOG10(value) → num`
|
||||
|
||||
|
@ -237,7 +238,7 @@ LOG10(10000) // 10
|
|||
LOG10(10) // 1
|
||||
LOG10(0) // null
|
||||
```
|
||||
!SUBSECTION MAX()
|
||||
### MAX()
|
||||
|
||||
`MAX(anyArray) → max`
|
||||
|
||||
|
@ -253,7 +254,7 @@ MAX( [5, 9, -2, null, 1] ) // 9
|
|||
MAX( [ null, null ] ) // null
|
||||
```
|
||||
|
||||
!SUBSECTION MEDIAN()
|
||||
### MEDIAN()
|
||||
|
||||
`MEDIAN(numArray) → median`
|
||||
|
||||
|
@ -274,7 +275,7 @@ MEDIAN( [ 4, 2, 3, 1 ] ) // 2.5
|
|||
MEDIAN( [ 999, 80, 4, 4, 4, 3, 3, 3 ] ) // 4
|
||||
```
|
||||
|
||||
!SUBSECTION MIN()
|
||||
### MIN()
|
||||
|
||||
`MIN(anyArray) → min`
|
||||
|
||||
|
@ -290,7 +291,7 @@ MIN( [5, 9, -2, null, 1] ) // -2
|
|||
MIN( [ null, null ] ) // null
|
||||
```
|
||||
|
||||
!SUBSECTION PERCENTILE()
|
||||
### PERCENTILE()
|
||||
|
||||
`PERCENTILE(numArray, n, method) → percentile`
|
||||
|
||||
|
@ -309,7 +310,7 @@ PERCENTILE( [1, 2, 3, 4], 50, "rank" ) // 2
|
|||
PERCENTILE( [1, 2, 3, 4], 50, "interpolation" ) // 2.5
|
||||
```
|
||||
|
||||
!SUBSECTION PI()
|
||||
### PI()
|
||||
|
||||
`PI() → pi`
|
||||
|
||||
|
@ -321,7 +322,7 @@ Return pi.
|
|||
PI() // 3.141592653589793
|
||||
```
|
||||
|
||||
!SUBSECTION POW()
|
||||
### POW()
|
||||
|
||||
`POW(base, exp) → num`
|
||||
|
||||
|
@ -337,7 +338,7 @@ POW( 5, -1 ) // 0.2
|
|||
POW( 5, 0 ) // 1
|
||||
```
|
||||
|
||||
!SUBSECTION RADIANS()
|
||||
### RADIANS()
|
||||
|
||||
`RADIANS(deg) → num`
|
||||
|
||||
|
@ -352,7 +353,7 @@ RADIANS(90) // 1.5707963267948966
|
|||
RADIANS(0) // 0
|
||||
```
|
||||
|
||||
!SUBSECTION RAND()
|
||||
### RAND()
|
||||
|
||||
`RAND() → randomNumber`
|
||||
|
||||
|
@ -390,7 +391,7 @@ Result:
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION RANGE()
|
||||
### RANGE()
|
||||
|
||||
`RANGE(start, stop, step) → numArray`
|
||||
|
||||
|
@ -415,7 +416,7 @@ RANGE(1.5, 2.5, 0.5) // [ 1.5, 2, 2.5 ]
|
|||
RANGE(-0.75, 1.1, 0.5) // [ -0.75, -0.25, 0.25, 0.75 ]
|
||||
```
|
||||
|
||||
!SUBSECTION ROUND()
|
||||
### ROUND()
|
||||
|
||||
`ROUND(value) → roundedValue`
|
||||
|
||||
|
@ -439,7 +440,7 @@ a combination of the [ternary operator](../Operators.md#ternary-operator),
|
|||
LET rounded = value >= 0 ? FLOOR(value) : CEIL(value)
|
||||
```
|
||||
|
||||
!SUBSECTION SIN()
|
||||
### SIN()
|
||||
|
||||
`SIN(value) → num`
|
||||
|
||||
|
@ -455,7 +456,7 @@ SIN(-3.141592653589783 / 2) // -1
|
|||
SIN(RADIANS(270)) // -1
|
||||
```
|
||||
|
||||
!SUBSECTION SQRT()
|
||||
### SQRT()
|
||||
|
||||
`SQRT(value) → squareRoot`
|
||||
|
||||
|
@ -482,7 +483,7 @@ POW(27, 1/3) // 3
|
|||
POW(9, 1/2) // 3
|
||||
```
|
||||
|
||||
!SUBSECTION STDDEV_POPULATION()
|
||||
### STDDEV_POPULATION()
|
||||
|
||||
`STDDEV_POPULATION(numArray) → num`
|
||||
|
||||
|
@ -497,7 +498,7 @@ Return the population standard deviation of the values in *array*.
|
|||
STDDEV_POPULATION( [ 1, 3, 6, 5, 2 ] ) // 1.854723699099141
|
||||
```
|
||||
|
||||
!SUBSECTION STDDEV_SAMPLE()
|
||||
### STDDEV_SAMPLE()
|
||||
|
||||
`STDDEV_SAMPLE(numArray) → num`
|
||||
|
||||
|
@ -512,7 +513,7 @@ Return the sample standard deviation of the values in *array*.
|
|||
STDDEV_SAMPLE( [ 1, 3, 6, 5, 2 ] ) // 2.0736441353327724
|
||||
```
|
||||
|
||||
!SUBSECTION SUM()
|
||||
### SUM()
|
||||
|
||||
`SUM(numArray) → sum`
|
||||
|
||||
|
@ -528,7 +529,7 @@ SUM( [null, -5, 6] ) // 1
|
|||
SUM( [ ] ) // 0
|
||||
```
|
||||
|
||||
!SUBSECTION TAN()
|
||||
### TAN()
|
||||
|
||||
`TAN(value) → num`
|
||||
|
||||
|
@ -543,7 +544,7 @@ TAN(5) // -3.380515006246586
|
|||
TAN(0) // 0
|
||||
```
|
||||
|
||||
!SUBSECTION VARIANCE_POPULATION()
|
||||
### VARIANCE_POPULATION()
|
||||
|
||||
`VARIANCE_POPULATION(numArray) → num`
|
||||
|
||||
|
@ -558,7 +559,7 @@ Return the population variance of the values in *array*.
|
|||
VARIANCE_POPULATION( [ 1, 3, 6, 5, 2 ] ) // 3.4400000000000004
|
||||
```
|
||||
|
||||
!SUBSECTION VARIANCE_SAMPLE()
|
||||
### VARIANCE_SAMPLE()
|
||||
|
||||
`VARIANCE_SAMPLE(array) → num`
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Functions
|
||||
Functions
|
||||
=========
|
||||
|
||||
AQL supports functions to allow more complex computations. Functions can be
|
||||
called at any query position where an expression is allowed. The general
|
||||
|
@ -25,7 +26,7 @@ COLLECTIONS()
|
|||
In contrast to collection and variable names, function names are case-insensitive,
|
||||
i.e. *LENGTH(foo)* and *length(foo)* are equivalent.
|
||||
|
||||
!SUBSECTION Extending AQL
|
||||
### Extending AQL
|
||||
|
||||
It is possible to extend AQL with user-defined functions. These functions need to
|
||||
be written in JavaScript, and have to be registered before they can be used in a query.
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
!CHAPTER String functions
|
||||
String functions
|
||||
================
|
||||
|
||||
For string processing, AQL offers the following functions:
|
||||
|
||||
!SUBSECTION CHAR_LENGTH()
|
||||
### CHAR_LENGTH()
|
||||
|
||||
`CHAR_LENGTH(value) → length`
|
||||
|
||||
Return the number of characters in *value* (not byte length).
|
||||
This is a synonym for [LENGTH()](#length).
|
||||
|
||||
!SUBSECTION CONCAT()
|
||||
### CONCAT()
|
||||
|
||||
`CONCAT(value1, value2, ... valueN) → str`
|
||||
|
||||
|
@ -38,7 +39,7 @@ CONCAT( [ "foo", "bar", "baz" ] ) // "foobarbaz"
|
|||
CONCAT( [1, 2, 3] ) // "123"
|
||||
```
|
||||
|
||||
!SUBSECTION CONCAT_SEPARATOR()
|
||||
### CONCAT_SEPARATOR()
|
||||
|
||||
`CONCAT_SEPARATOR(separator, value1, value2, ... valueN) → joinedString`
|
||||
|
||||
|
@ -68,7 +69,7 @@ CONCAT_SEPARATOR("-", [1, 2, 3, null], [4, null, 5])
|
|||
// "1-2-3-4-5"
|
||||
```
|
||||
|
||||
!SUBSECTION CONTAINS()
|
||||
### CONTAINS()
|
||||
|
||||
`CONTAINS(text, search, returnIndex) → match`
|
||||
|
||||
|
@ -92,11 +93,11 @@ CONTAINS("foobarbaz", "ba", true) // 3
|
|||
CONTAINS("foobarbaz", "horse", true) // -1
|
||||
```
|
||||
|
||||
!SUBSECTION COUNT()
|
||||
### COUNT()
|
||||
|
||||
This is an alias for [LENGTH()](#length).
|
||||
|
||||
!SUBSECTION FIND_FIRST()
|
||||
### FIND_FIRST()
|
||||
|
||||
`FIND_FIRST(text, search, start, end) → position`
|
||||
|
||||
|
@ -118,7 +119,7 @@ FIND_FIRST("foobarbaz", "ba", 4) // 6
|
|||
FIND_FIRST("foobarbaz", "ba", 0, 3) // -1
|
||||
```
|
||||
|
||||
!SUBSECTION FIND_LAST()
|
||||
### FIND_LAST()
|
||||
|
||||
`FIND_LAST(text, search, start, end) → position`
|
||||
|
||||
|
@ -140,7 +141,7 @@ FIND_LAST("foobarbaz", "ba", 7) // -1
|
|||
FIND_LAST("foobarbaz", "ba", 0, 4) // 3
|
||||
```
|
||||
|
||||
!SUBSECTION JSON_PARSE()
|
||||
### JSON_PARSE()
|
||||
|
||||
`JSON_PARSE(text) → value`
|
||||
|
||||
|
@ -158,7 +159,7 @@ JSON_PARSE("{\\\"a\\\": 1}") // { a : 1 }
|
|||
JSON_PARSE("abc") // null
|
||||
```
|
||||
|
||||
!SUBSECTION JSON_STRINGIFY()
|
||||
### JSON_STRINGIFY()
|
||||
|
||||
`JSON_STRINGIFY(value) → text`
|
||||
|
||||
|
@ -175,7 +176,7 @@ JSON_STRINGIFY("abc") // "\"abc\""
|
|||
JSON_STRINGIFY("[1, 2, 3]") // "[1,2,3]"
|
||||
```
|
||||
|
||||
!SUBSECTION LEFT()
|
||||
### LEFT()
|
||||
|
||||
`LEFT(value, length) → substring`
|
||||
|
||||
|
@ -191,7 +192,7 @@ LEFT("foobar", 3) // "foo"
|
|||
LEFT("foobar", 10) // "foobar"
|
||||
```
|
||||
|
||||
!SUBSECTION LENGTH()
|
||||
### LENGTH()
|
||||
|
||||
`LENGTH(str) → length`
|
||||
|
||||
|
@ -209,7 +210,7 @@ LENGTH("电脑坏了") // 4
|
|||
the [number of attribute keys](Document.md#length) of an object / document and
|
||||
the [amount of documents](Miscellaneous.md#length) in a collection.
|
||||
|
||||
!SUBSECTION LIKE()
|
||||
### LIKE()
|
||||
|
||||
`LIKE(text, search, caseInsensitive) → bool`
|
||||
|
||||
|
@ -241,7 +242,7 @@ LIKE("FoO bAr BaZ", "fOo%bAz") // false
|
|||
LIKE("FoO bAr BaZ", "fOo%bAz", true) // true
|
||||
```
|
||||
|
||||
!SUBSECTION LOWER()
|
||||
### LOWER()
|
||||
|
||||
`LOWER(value) → lowerCaseString`
|
||||
|
||||
|
@ -252,7 +253,7 @@ All other characters are returned unchanged.
|
|||
- returns **lowerCaseString** (string): *value* with upper-case characters converted
|
||||
to lower-case characters
|
||||
|
||||
!SUBSECTION LTRIM()
|
||||
### LTRIM()
|
||||
|
||||
`LTRIM(value, chars) → strippedString`
|
||||
|
||||
|
@ -271,7 +272,7 @@ LTRIM(" foo bar ") // "foo bar "
|
|||
LTRIM("--==[foo-bar]==--", "-=[]") // "foo-bar]==--"
|
||||
```
|
||||
|
||||
!SUBSECTION MD5()
|
||||
### MD5()
|
||||
|
||||
`MD5(text) → hash`
|
||||
|
||||
|
@ -285,7 +286,7 @@ string representation.
|
|||
MD5("foobar") // "3858f62230ac3c915f300c664312c63f"
|
||||
```
|
||||
|
||||
!SUBSECTION RANDOM_TOKEN()
|
||||
### RANDOM_TOKEN()
|
||||
|
||||
`RANDOM_TOKEN(length) → randomString`
|
||||
|
||||
|
@ -302,7 +303,7 @@ RANDOM_TOKEN(8) // "zGl09z42"
|
|||
RANDOM_TOKEN(8) // "m9w50Ft9"
|
||||
```
|
||||
|
||||
!SUBSECTION REGEX_TEST()
|
||||
### REGEX_TEST()
|
||||
|
||||
`REGEX_TEST(text, search, caseInsensitive) → bool`
|
||||
|
||||
|
@ -368,7 +369,7 @@ REGEX_TEST("the quick brown fox", "^(a|the)\s+(quick|slow).*f.x$") // true
|
|||
REGEX_TEST("the\nquick\nbrown\nfox", "^the(\n[a-w]+)+\nfox$") // true
|
||||
```
|
||||
|
||||
!SUBSECTION REVERSE()
|
||||
### REVERSE()
|
||||
|
||||
`REVERSE(value) → reversedString`
|
||||
|
||||
|
@ -383,7 +384,7 @@ REVERSE("foobar") // "raboof"
|
|||
REVERSE("电脑坏了") // "了坏脑电"
|
||||
```
|
||||
|
||||
!SUBSECTION RIGHT()
|
||||
### RIGHT()
|
||||
|
||||
`RIGHT(value, length) → substring`
|
||||
|
||||
|
@ -399,7 +400,7 @@ RIGHT("foobar", 3) // "bar"
|
|||
RIGHT("foobar", 10) // "foobar"
|
||||
```
|
||||
|
||||
!SUBSECTION RTRIM()
|
||||
### RTRIM()
|
||||
|
||||
`RTRIM(value, chars) → strippedString`
|
||||
|
||||
|
@ -418,7 +419,7 @@ RTRIM(" foo bar ") // " foo bar"
|
|||
RTRIM("--==[foo-bar]==--", "-=[]") // "--==[foo-bar"
|
||||
```
|
||||
|
||||
!SUBSECTION SHA1()
|
||||
### SHA1()
|
||||
|
||||
`SHA1(text) → hash`
|
||||
|
||||
|
@ -432,7 +433,7 @@ string representation.
|
|||
SHA1("foobar") // "8843d7f92416211de9ebb963ff4ce28125932878"
|
||||
```
|
||||
|
||||
!SUBSECTION SPLIT()
|
||||
### SPLIT()
|
||||
|
||||
`SPLIT(value, separator, limit) → strArray`
|
||||
|
||||
|
@ -452,7 +453,7 @@ SPLIT( "foo-bar-baz", "-", 1 ) // [ "foo", "bar-baz" ]
|
|||
SPLIT( "foo, bar & baz", [ ", ", " & " ] ) // [ "foo", "bar", "baz" ]
|
||||
```
|
||||
|
||||
!SUBSECTION SUBSTITUTE()
|
||||
### SUBSTITUTE()
|
||||
|
||||
`SUBSTITUTE(value, search, replace, limit) → substitutedString`
|
||||
|
||||
|
@ -524,7 +525,7 @@ SUBSTITUTE("the quick brown foxx", {
|
|||
// "the small slow foxx"
|
||||
```
|
||||
|
||||
!SUBSECTION SUBSTRING()
|
||||
### SUBSTRING()
|
||||
|
||||
`SUBSTRING(value, offset, length) → substring`
|
||||
|
||||
|
@ -536,7 +537,7 @@ Return a substring of *value*.
|
|||
substring from *offset* to the end of the string
|
||||
- returns **substring** (string): a substring of *value*
|
||||
|
||||
!SUBSECTION TRIM()
|
||||
### TRIM()
|
||||
|
||||
`TRIM(value, type) → strippedString`
|
||||
|
||||
|
@ -571,7 +572,7 @@ TRIM(" foobar\t \r\n ") // "foobar"
|
|||
TRIM(";foo;bar;baz, ", ",; ") // "foo;bar;baz"
|
||||
```
|
||||
|
||||
!SUBSECTION UPPER()
|
||||
### UPPER()
|
||||
|
||||
`UPPER(value) → upperCaseString`
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Type cast functions
|
||||
Type cast functions
|
||||
===================
|
||||
|
||||
Some operators expect their operands to have a certain data type. For example,
|
||||
logical operators expect their operands to be boolean values, and the arithmetic
|
||||
|
@ -13,7 +14,7 @@ Each of the these functions takes an operand of any data type and returns a resu
|
|||
value with the type corresponding to the function name. For example, *TO_NUMBER()*
|
||||
will return a numeric value.
|
||||
|
||||
!SUBSECTION TO_BOOL()
|
||||
### TO_BOOL()
|
||||
|
||||
`TO_BOOL(value) → bool`
|
||||
|
||||
|
@ -41,7 +42,7 @@ not not 1 // true
|
|||
|
||||
`TO_BOOL()` is preferred however, because it states the intention clearer.
|
||||
|
||||
!SUBSECTION TO_NUMBER()
|
||||
### TO_NUMBER()
|
||||
|
||||
`TO_NUMBER(value) → number`
|
||||
|
||||
|
@ -76,7 +77,7 @@ Take an input *value* of any type and convert it into a numeric value.
|
|||
-{} // 0
|
||||
```
|
||||
|
||||
!SUBSECTION TO_STRING()
|
||||
### TO_STRING()
|
||||
|
||||
`TO_STRING(value) → str`
|
||||
|
||||
|
@ -103,7 +104,7 @@ TO_STRING( [1, 2, 3] ) // "[1,2,3]"
|
|||
TO_STRING( { foo: "bar", baz: null } ) // "{\"foo\":\"bar\",\"baz\":null}"
|
||||
```
|
||||
|
||||
!SUBSECTION TO_ARRAY()
|
||||
### TO_ARRAY()
|
||||
|
||||
`TO_ARRAY(value) → array`
|
||||
|
||||
|
@ -128,13 +129,14 @@ TO_ARRAY([1, 2, "foo"]) // [1, 2, "foo"]
|
|||
TO_ARRAY({foo: 1, bar: 2, baz: [3, 4, 5]}) // [1, 2, [3, 4, 5]]
|
||||
```
|
||||
|
||||
!SUBSECTION TO_LIST()
|
||||
### TO_LIST()
|
||||
|
||||
`TO_LIST(value) → array`
|
||||
|
||||
This is an alias for [TO_ARRAY()](#toarray).
|
||||
|
||||
!CHAPTER Type check functions
|
||||
Type check functions
|
||||
====================
|
||||
|
||||
AQL also offers functions to check the data type of a value at runtime. The
|
||||
following type check functions are available. Each of these functions takes an
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Bind parameters
|
||||
Bind parameters
|
||||
===============
|
||||
|
||||
AQL supports the usage of bind parameters, thus allowing to separate the query
|
||||
text from literal values used in the query. It is good practice to separate the
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Data types
|
||||
Data types
|
||||
==========
|
||||
|
||||
AQL supports both primitive and compound data types. The following types are
|
||||
available:
|
||||
|
@ -12,9 +13,10 @@ available:
|
|||
- array: Sequence of values, referred to by their positions
|
||||
- object / document: Sequence of values, referred to by their names
|
||||
|
||||
!SECTION Primitive types
|
||||
Primitive types
|
||||
---------------
|
||||
|
||||
!SUBSECTION Numeric literals
|
||||
### Numeric literals
|
||||
|
||||
Numeric literals can be integers or real values. They can optionally be signed
|
||||
using the *+* or *-* symbols. The scientific notation is also supported.
|
||||
|
@ -33,7 +35,7 @@ using the *+* or *-* symbols. The scientific notation is also supported.
|
|||
All numeric values are treated as 64-bit double-precision values internally.
|
||||
The internal format used is IEEE 754.
|
||||
|
||||
!SUBSECTION String literals
|
||||
### String literals
|
||||
|
||||
String literals must be enclosed in single or double quotes. If the used quote
|
||||
character is to be used itself within the string literal, it must be escaped
|
||||
|
@ -58,14 +60,15 @@ arbitrary binary data if it is not UTF-8 encoded. A workaround to use binary
|
|||
data is to encode the data using base64 or other algorithms on the application
|
||||
side before storing, and decoding it on application side after retrieval.
|
||||
|
||||
!SECTION Compound types
|
||||
Compound types
|
||||
--------------
|
||||
|
||||
AQL supports two compound types:
|
||||
|
||||
- arrays: A composition of unnamed values, each accessible by their positions
|
||||
- objects / documents: A composition of named values, each accessible by their names
|
||||
|
||||
!SUBSECTION Arrays / Lists
|
||||
### Arrays / Lists
|
||||
|
||||
The first supported compound type is the array type. Arrays are effectively
|
||||
sequences of (unnamed / anonymous) values. Individual array elements can be
|
||||
|
@ -111,7 +114,7 @@ u.friends[-1]
|
|||
u.friends[-2]
|
||||
```
|
||||
|
||||
!SUBSECTION Objects / Documents
|
||||
### Objects / Documents
|
||||
|
||||
The other supported compound type is the object (or document) type. Objects are a
|
||||
composition of zero to many attributes. Each attribute is a name/value pair.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Accessing data from collections
|
||||
Accessing data from collections
|
||||
===============================
|
||||
|
||||
Collection data can be accessed by specifying a collection name in a query. A
|
||||
collection can be understood as an array of documents, and that is how they are
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Errors
|
||||
Errors
|
||||
======
|
||||
|
||||
Issuing an invalid query to the server will result in a parse error if the query
|
||||
is syntactically invalid. ArangoDB will detect such errors during query
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER Query results
|
||||
Query results
|
||||
=============
|
||||
|
||||
!SUBSECTION Result sets
|
||||
### Result sets
|
||||
|
||||
The result of an AQL query is an array of values. The individual values in the
|
||||
result array may or may not have a homogeneous structure, depending on what is
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER AQL Fundamentals
|
||||
AQL Fundamentals
|
||||
================
|
||||
|
||||
|
||||
* [AQL Syntax](Syntax.md) explains the structure of the AQL language.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER AQL Syntax
|
||||
AQL Syntax
|
||||
==========
|
||||
|
||||
!SUBSECTION Query types
|
||||
### Query types
|
||||
|
||||
An AQL query must either return a result (indicated by usage of the *RETURN*
|
||||
keyword) or execute a data-modification operation (indicated by usage
|
||||
|
@ -13,14 +14,14 @@ AQL only allows *one* query in a single query string; thus semicolons to
|
|||
indicate the end of one query and separate multiple queries (as seen in SQL) are
|
||||
not allowed.
|
||||
|
||||
!SUBSECTION Whitespace
|
||||
### Whitespace
|
||||
|
||||
Whitespaces (blanks, carriage returns, line feeds, and tab stops) can be used
|
||||
in the query text to increase its readability. Tokens have to be separated by
|
||||
any number of whitespaces. Whitespace within strings or names must be enclosed
|
||||
in quotes in order to be preserved.
|
||||
|
||||
!SUBSECTION Comments
|
||||
### Comments
|
||||
|
||||
Comments can be embedded at any position in a query. The text contained in the
|
||||
comment is ignored by the AQL parser.
|
||||
|
@ -44,7 +45,7 @@ AQL supports two types of comments:
|
|||
comment */
|
||||
// a single line comment
|
||||
|
||||
!SUBSECTION Keywords
|
||||
### Keywords
|
||||
|
||||
On the top level, AQL offers the following operations:
|
||||
- `FOR`: array iteration
|
||||
|
@ -130,7 +131,7 @@ The complete list of keywords is currently:
|
|||
</ul>
|
||||
</div>
|
||||
|
||||
!SUBSECTION Names
|
||||
### Names
|
||||
|
||||
In general, names are used to identify objects (collections, attributes,
|
||||
variables, and functions) in AQL queries.
|
||||
|
@ -158,7 +159,7 @@ FOR f IN ´filter´
|
|||
RETURN f.´sort´
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Collection names
|
||||
#### Collection names
|
||||
|
||||
Collection names can be used in queries as they are. If a collection happens to
|
||||
have the same name as a keyword, the name must be enclosed in backticks.
|
||||
|
@ -169,7 +170,7 @@ about collection naming conventions.
|
|||
AQL currently has a limit of up to 256 collections used in one AQL query.
|
||||
This limit applies to the sum of all involved document and edge collections.
|
||||
|
||||
!SUBSUBSECTION Attribute names
|
||||
#### Attribute names
|
||||
|
||||
When referring to attributes of documents from a collection, the fully qualified
|
||||
attribute name must be used. This is because multiple collections with ambiguous
|
||||
|
@ -190,7 +191,7 @@ In the above example, the attribute names *active*, *name*, *id*, and *userId*
|
|||
are qualified using the collection names they belong to (*u* and *f*
|
||||
respectively).
|
||||
|
||||
!SUBSUBSECTION Variable names
|
||||
#### Variable names
|
||||
|
||||
AQL allows the user to assign values to additional variables in a query. All
|
||||
variables that are assigned a value must have a name that is unique within the
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Type and value order
|
||||
Type and value order
|
||||
====================
|
||||
|
||||
When checking for equality or inequality or when determining the sort order of
|
||||
values, AQL uses a deterministic algorithm that takes both the data types and
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Graphs in AQL
|
||||
Graphs in AQL
|
||||
=============
|
||||
|
||||
There are multiple ways to work with [graphs in ArangoDB](../../Manual/Graphs/index.html),
|
||||
as well as different ways to query your graphs using AQL.
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Shortest Path in AQL
|
||||
Shortest Path in AQL
|
||||
====================
|
||||
|
||||
!SECTION General query idea
|
||||
General query idea
|
||||
------------------
|
||||
|
||||
This type of query is supposed to find the shortest path between two given documents
|
||||
(*startVertex* and *targetVertex*) in your graph. For all vertices on this shortest
|
||||
|
@ -9,7 +11,7 @@ path you will get a result in form of a set with two items:
|
|||
1. The vertex on this path.
|
||||
2. The edge pointing to it.
|
||||
|
||||
!SUBSECTION Example execution
|
||||
### Example execution
|
||||
|
||||
Let's take a look at a simple example to explain how it works.
|
||||
This is the graph that we are going to find a shortest path on:
|
||||
|
@ -35,13 +37,14 @@ return the following pairs:
|
|||
Note: The first edge will always be `null` because there is no edge pointing
|
||||
to the *startVertex*.
|
||||
|
||||
!SECTION Syntax
|
||||
Syntax
|
||||
------
|
||||
|
||||
Now let's see how we can write a shortest path query.
|
||||
You have two options here, you can either use a named graph or a set of edge
|
||||
collections (anonymous graph).
|
||||
|
||||
!SUBSUBSECTION Working with named graphs
|
||||
#### Working with named graphs
|
||||
|
||||
```
|
||||
FOR vertex[, edge]
|
||||
|
@ -72,7 +75,7 @@ FOR vertex[, edge]
|
|||
no *weightAttribute* in the edge document, or if it's not a number. The default
|
||||
is 1.
|
||||
|
||||
!SUBSECTION Working with collection sets
|
||||
### Working with collection sets
|
||||
|
||||
```
|
||||
FOR vertex[, edge]
|
||||
|
@ -86,7 +89,7 @@ Instead of `GRAPH graphName` you may specify a list of edge collections (anonymo
|
|||
graph). The involved vertex collections are determined by the edges of the given
|
||||
edge collections. The rest of the behavior is similar to the named version.
|
||||
|
||||
!SUBSECTION Traversing in mixed directions
|
||||
### Traversing in mixed directions
|
||||
|
||||
For shortest path with a list of edge collections you can optionally specify the
|
||||
direction for some of the edge collections. Say for example you have three edge
|
||||
|
@ -105,7 +108,8 @@ All collections in the list that do not specify their own direction will use the
|
|||
direction defined after *IN* (here: *OUTBOUND*). This allows to use a different
|
||||
direction for each collection in your path search.
|
||||
|
||||
!SECTION Conditional shortest path
|
||||
Conditional shortest path
|
||||
-------------------------
|
||||
|
||||
The SHORTEST_PATH computation will only find an unconditioned shortest path.
|
||||
With this construct it is not possible to define a condition like: "Find the
|
||||
|
@ -113,7 +117,8 @@ shortest path where all edges are of type *X*". If you want to do this, use a
|
|||
normal [Traversal](Traversals.md) instead with the option `{bfs: true}` in
|
||||
combination with `LIMIT 1`.
|
||||
|
||||
!SECTION Examples
|
||||
Examples
|
||||
--------
|
||||
We will create a simple symmetric traversal demonstration graph:
|
||||
|
||||

|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER Graph traversals in AQL
|
||||
Graph traversals in AQL
|
||||
=======================
|
||||
|
||||
!SECTION General query idea
|
||||
General query idea
|
||||
------------------
|
||||
|
||||
A traversal starts at one specific document (*startVertex*) and follows all
|
||||
edges connected to this document. For all documents (*vertices*) that are
|
||||
|
@ -20,7 +22,7 @@ set with three items:
|
|||
is the *startVertex* and the last is the visited vertex, and the n-th element
|
||||
in *edges* connects the n-th element with the (n+1)-th element in *vertices*.
|
||||
|
||||
!SUBSECTION Example execution
|
||||
### Example execution
|
||||
|
||||
Let's take a look at a simple example to explain how it works.
|
||||
This is the graph that we are going to traverse:
|
||||
|
@ -79,13 +81,14 @@ has returned the following paths:
|
|||
6. **A** → **G** → **J**
|
||||
|
||||
|
||||
!SECTION Syntax
|
||||
Syntax
|
||||
------
|
||||
|
||||
Now let's see how we can write a query that follows this schema.
|
||||
You have two options here, you can either use a named graph or a set of edge
|
||||
collections (anonymous graph).
|
||||
|
||||
!SUBSECTION Working with named graphs
|
||||
### Working with named graphs
|
||||
|
||||
```
|
||||
FOR vertex[, edge[, path]]
|
||||
|
@ -148,7 +151,7 @@ FOR vertex[, edge[, path]]
|
|||
return all paths from *min* depth to *max* depth for one vertex at depth 1.
|
||||
Than for the next vertex at depth 1 and so on.
|
||||
|
||||
!SUBSECTION Working with collection sets
|
||||
### Working with collection sets
|
||||
|
||||
```
|
||||
FOR vertex[, edge[, path]]
|
||||
|
@ -165,7 +168,7 @@ If the same edge collection is specified multiple times, it will behave as if it
|
|||
were specified only once. Specifying the same edge collection is only allowed when
|
||||
the collections do not have conflicting traversal directions.
|
||||
|
||||
!SUBSECTION Traversing in mixed directions
|
||||
### Traversing in mixed directions
|
||||
|
||||
For traversals with a list of edge collections you can optionally specify the
|
||||
direction for some of the edge collections. Say for example you have three edge
|
||||
|
@ -184,7 +187,8 @@ All collections in the list that do not specify their own direction will use the
|
|||
direction defined after `IN`. This allows to use a different direction for each
|
||||
collection in your traversal.
|
||||
|
||||
!SECTION Using filters and the explainer to extrapolate the costs
|
||||
Using filters and the explainer to extrapolate the costs
|
||||
--------------------------------------------------------
|
||||
|
||||
All three variables emitted by the traversals might as well be used in filter
|
||||
statements. For some of these filter statements the optimizer can detect that it
|
||||
|
@ -197,7 +201,7 @@ with a length greater than *max* will never be computed.
|
|||
In the current state, `AND` combined filters can be optimized, but `OR`
|
||||
combined filters cannot.
|
||||
|
||||
!SUBSECTION Filtering on paths
|
||||
### Filtering on paths
|
||||
|
||||
Filtering on paths allows for the most powerful filtering and may have the
|
||||
highest impact on performance. Using the path variable you can filter on
|
||||
|
@ -205,7 +209,7 @@ specific iteration depths. You can filter for absolute positions in the path
|
|||
by specifying a positive number (which then qualifies for the optimizations),
|
||||
or relative positions to the end of the path by specifying a negative number.
|
||||
|
||||
!SUBSUBSECTION Filtering edges on the path
|
||||
#### Filtering edges on the path
|
||||
|
||||
```js
|
||||
FOR v, e, p IN 1..5 OUTBOUND 'circles/A' GRAPH 'traversalGraph'
|
||||
|
@ -216,7 +220,7 @@ FOR v, e, p IN 1..5 OUTBOUND 'circles/A' GRAPH 'traversalGraph'
|
|||
will filter all paths where the start edge (index 0) has the attribute
|
||||
*theTruth* equal to *true*. The resulting paths will be up to 5 items long.
|
||||
|
||||
!SUBSECTION Filtering vertices on the path
|
||||
### Filtering vertices on the path
|
||||
|
||||
Similar to filtering the edges on the path you can also filter the vertices:
|
||||
|
||||
|
@ -226,7 +230,7 @@ FOR v, e, p IN 1..5 OUTBOUND 'circles/A' GRAPH 'traversalGraph'
|
|||
RETURN p
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Combining several filters
|
||||
#### Combining several filters
|
||||
|
||||
And of course you can combine these filters in any way you like:
|
||||
|
||||
|
@ -247,7 +251,7 @@ the attribute *theFalse* equal to *false*. The resulting paths will be up to
|
|||
depth 2. This is because for all results in depth 1 the second edge does not
|
||||
exist and hence cannot fulfill the condition here.
|
||||
|
||||
!SUBSUBSECTION Filter on the entire path
|
||||
#### Filter on the entire path
|
||||
|
||||
With the help of array comparison operators filters can also be defined
|
||||
on the entire path, like ALL edges should have theTruth == true:
|
||||
|
@ -281,7 +285,7 @@ It is guaranteed that at least one, but potentially more edges fulfill the condi
|
|||
All of the above filters can be defined on vertices in the exact same way.
|
||||
|
||||
|
||||
!SUBSECTION Examples
|
||||
### Examples
|
||||
|
||||
We will create a simple symmetric traversal demonstration graph:
|
||||
|
||||
|
@ -326,7 +330,7 @@ are right behind the fork:
|
|||
As you can see, we can express this in two ways: with or without *max* parameter
|
||||
in the expression.
|
||||
|
||||
!SUBSECTION Filter examples
|
||||
### Filter examples
|
||||
|
||||
Now let's start to add some filters. We want to cut of the branch on the right
|
||||
side of the graph, we may filter in two ways:
|
||||
|
@ -358,7 +362,8 @@ We also may combine several filters, for instance to filter out the right branch
|
|||
|
||||
As you can see, combining two `FILTER` statements with an `AND` has the same result.
|
||||
|
||||
!SECTION Comparing OUTBOUND / INBOUND / ANY
|
||||
Comparing OUTBOUND / INBOUND / ANY
|
||||
----------------------------------
|
||||
|
||||
All our previous examples traversed the graph in *OUTBOUND* edge direction.
|
||||
You may however want to also traverse in reverse direction (*INBOUND*) or
|
||||
|
@ -385,7 +390,8 @@ have edges in other directions and they will be traversed.
|
|||
if it walks from **E** to **F**, it will continue to walk from **F** to **E**
|
||||
using the same edge once again. Due to this we will see duplicate nodes in the result.
|
||||
|
||||
!SECTION Use the AQL explainer for optimizations
|
||||
Use the AQL explainer for optimizations
|
||||
---------------------------------------
|
||||
|
||||
Now let's have a look what the optimizer does behind the curtain and inspect
|
||||
traversal queries using [the explainer](../ExecutionAndPerformance/Optimizer.md):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER How to invoke AQL
|
||||
How to invoke AQL
|
||||
=================
|
||||
|
||||
AQL queries can be executed using:
|
||||
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
!CHAPTER Executing queries from Arangosh
|
||||
Executing queries from Arangosh
|
||||
===============================
|
||||
|
||||
Within the ArangoDB shell, the *_query* and *_createStatement* methods of the
|
||||
*db* object can be used to execute AQL queries. This chapter also describes
|
||||
how to use bind parameters, counting, statistics and cursors.
|
||||
|
||||
!SUBSECTION with db._query
|
||||
### with db._query
|
||||
|
||||
One can execute queries with the *_query* method of the *db* object.
|
||||
This will run the specified query in the context of the currently
|
||||
|
@ -20,7 +21,7 @@ can be printed using its *toArray* method:
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock 01_workWithAQL_all
|
||||
|
||||
!SUBSUBSECTION db._query Bind parameters
|
||||
#### db._query Bind parameters
|
||||
|
||||
To pass bind parameters into a query, they can be specified as second argument to the
|
||||
*_query* method:
|
||||
|
@ -35,7 +36,7 @@ To pass bind parameters into a query, they can be specified as second argument t
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock 02_workWithAQL_bindValues
|
||||
|
||||
!SUBSUBSECTION ES6 template strings
|
||||
#### ES6 template strings
|
||||
|
||||
It is also possible to use ES6 template strings for generating AQL queries. There is
|
||||
a template string generator function named *aql*; we call it once to demonstrate
|
||||
|
@ -76,7 +77,7 @@ Note: data-modification AQL queries normally do not return a result (unless the
|
|||
contains an extra *RETURN* statement). When not using a *RETURN* statement in the query, the
|
||||
*toArray* method will return an empty array.
|
||||
|
||||
!SUBSUBSECTION Statistics and extra Information
|
||||
#### Statistics and extra Information
|
||||
|
||||
It is always possible to retrieve statistics for a query with the *getExtra* method:
|
||||
|
||||
|
@ -92,7 +93,7 @@ It is always possible to retrieve statistics for a query with the *getExtra* met
|
|||
The meaning of the statistics values is described in [Execution statistics](../ExecutionAndPerformance/QueryStatistics.md).
|
||||
You also will find warnings in here; If you're designing queries on the shell be sure to also look at it.
|
||||
|
||||
!SUBSECTION with _createStatement (ArangoStatement)
|
||||
### with _createStatement (ArangoStatement)
|
||||
|
||||
The *_query* method is a shorthand for creating an ArangoStatement object,
|
||||
executing it and iterating over the resulting cursor. If more control over the
|
||||
|
@ -115,7 +116,7 @@ To execute the query, use the *execute* method of the statement:
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock 05_workWithAQL_statements2
|
||||
|
||||
!SUBSUBSECTION Cursors
|
||||
#### Cursors
|
||||
|
||||
Once the query executed the query results are available in a cursor.
|
||||
The cursor can return all its results at once using the *toArray* method.
|
||||
|
@ -150,7 +151,7 @@ the results again, the query needs to be re-executed.
|
|||
Additionally, the iteration can be done in a forward-only fashion. There is no
|
||||
backwards iteration or random access to elements in a cursor.
|
||||
|
||||
!SUBSUBSECTION ArangoStatement parameters binding
|
||||
#### ArangoStatement parameters binding
|
||||
|
||||
To execute an AQL query using bind parameters, you need to create a statement first
|
||||
and then bind the parameters to it before execution:
|
||||
|
@ -204,7 +205,7 @@ making it a bit more convenient:
|
|||
@END_EXAMPLE_ARANGOSH_OUTPUT
|
||||
@endDocuBlock 05_workWithAQL_statements8
|
||||
|
||||
!SUBSUBSECTION Counting with a cursor
|
||||
#### Counting with a cursor
|
||||
|
||||
Cursors also optionally provide the total number of results. By default, they do not.
|
||||
To make the server return the total number of results, you may set the *count* attribute to
|
||||
|
@ -247,7 +248,7 @@ on the server-side and may be able to apply optimizations if a result set is not
|
|||
a client.
|
||||
|
||||
|
||||
!SUBSUBSECTION Using cursors to obtain additional information on internal timings
|
||||
#### Using cursors to obtain additional information on internal timings
|
||||
|
||||
Cursors can also optionally provide statistics of the internal execution phases. By default, they do not.
|
||||
To get to know how long parsing, otpimisation, instanciation and execution took,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER AQL with ArangoDB Web Interface
|
||||
AQL with ArangoDB Web Interface
|
||||
===============================
|
||||
|
||||
|
||||
In the ArangoDB Web Interface the AQL Editor tab allows to execute ad-hoc AQL
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER COLLECT
|
||||
COLLECT
|
||||
=======
|
||||
|
||||
The *COLLECT* keyword can be used to group an array by one or multiple group
|
||||
criteria.
|
||||
|
@ -22,7 +23,7 @@ COLLECT WITH COUNT INTO countVariable options
|
|||
|
||||
`options` is optional in all variants.
|
||||
|
||||
!SUBSECTION Grouping syntaxes
|
||||
### Grouping syntaxes
|
||||
|
||||
The first syntax form of *COLLECT* only groups the result by the defined group
|
||||
criteria specified in *expression*. In order to further process the results
|
||||
|
@ -84,7 +85,7 @@ by city, and for each distinct combination of country and city, the users
|
|||
will be returned.
|
||||
|
||||
|
||||
!SUBSECTION Discarding obsolete variables
|
||||
### Discarding obsolete variables
|
||||
|
||||
The third form of *COLLECT* allows rewriting the contents of the *groupsVariable*
|
||||
using an arbitrary *projectionExpression*:
|
||||
|
@ -146,7 +147,7 @@ be used in the *KEEP* clause. *KEEP* supports the specification of multiple
|
|||
variable names.
|
||||
|
||||
|
||||
!SUBSECTION Group length calculation
|
||||
### Group length calculation
|
||||
|
||||
*COLLECT* also provides a special *WITH COUNT* clause that can be used to
|
||||
determine the number of group members efficiently.
|
||||
|
@ -184,7 +185,7 @@ FOR u IN users
|
|||
Note: the *WITH COUNT* clause can only be used together with an *INTO* clause.
|
||||
|
||||
|
||||
!SUBSECTION Aggregation
|
||||
### Aggregation
|
||||
|
||||
A `COLLECT` statement can be used to perform aggregation of data per group. To
|
||||
only determine group lengths, the `WITH COUNT INTO` variant of `COLLECT` can be
|
||||
|
@ -246,7 +247,7 @@ assignment:
|
|||
- an aggregate expression must not refer to variables introduced by the `COLLECT` itself
|
||||
|
||||
|
||||
!SUBSECTION COLLECT variants
|
||||
### COLLECT variants
|
||||
|
||||
Since ArangoDB 2.6, there are two variants of *COLLECT* that the optimizer can
|
||||
choose from: the *sorted* variant and the *hash* variant. The *hash* variant only becomes a
|
||||
|
@ -289,7 +290,7 @@ Which variant of *COLLECT* was actually used can be figured out by looking into
|
|||
a query, specifically the *AggregateNode* and its *aggregationOptions* attribute.
|
||||
|
||||
|
||||
!SUBSECTION Setting COLLECT options
|
||||
### Setting COLLECT options
|
||||
|
||||
*options* can be used in a *COLLECT* statement to inform the optimizer about the preferred *COLLECT*
|
||||
method. When specifying the following appendix to a *COLLECT* statement, the optimizer will always use
|
||||
|
@ -304,7 +305,7 @@ because the *hash* variant is not eligible for all queries. Instead, if no optio
|
|||
than *sorted* are specified in *OPTIONS*, the optimizer will use its regular cost estimations.
|
||||
|
||||
|
||||
!SUBSECTION COLLECT vs. RETURN DISTINCT
|
||||
### COLLECT vs. RETURN DISTINCT
|
||||
|
||||
In order to make a result set unique, one can either use *COLLECT* or *RETURN DISTINCT*. Behind the
|
||||
scenes, both variants will work by creating an *AggregateNode*. For both variants, the optimizer
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
!CHAPTER FILTER
|
||||
FILTER
|
||||
======
|
||||
|
||||
The *FILTER* statement can be used to restrict the results to elements that
|
||||
match an arbitrary logical condition.
|
||||
|
||||
!SECTION General syntax
|
||||
General syntax
|
||||
--------------
|
||||
|
||||
```
|
||||
FILTER condition
|
||||
|
@ -41,7 +43,8 @@ elements of *users* will be skipped and not be included in the result produced
|
|||
by *RETURN*. You may refer to the chapter [Accessing Data from Collections](../Fundamentals/DocumentData.md)
|
||||
for a description of the impact of non-existent or null attributes.
|
||||
|
||||
!SECTION Order of operations
|
||||
Order of operations
|
||||
-------------------
|
||||
|
||||
Note that the positions of *FILTER* statements can influence the result of a query.
|
||||
There are 16 active users in the [test data](../Examples/README.md#example-data)
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER FOR
|
||||
FOR
|
||||
===
|
||||
|
||||
|
||||
The *FOR* keyword can be to iterate over all elements of an array.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER INSERT
|
||||
INSERT
|
||||
======
|
||||
|
||||
The *INSERT* keyword can be used to insert new documents into a collection. On a
|
||||
single server, an insert operation is executed transactionally in an all-or-nothing
|
||||
|
@ -39,7 +40,7 @@ FOR u IN users
|
|||
INSERT { _from: u._id, _to: p._id } IN recommendations
|
||||
```
|
||||
|
||||
!SUBSECTION Setting query options
|
||||
### Setting query options
|
||||
|
||||
*options* can be used to suppress query errors that may occur when violating unique
|
||||
key constraints:
|
||||
|
@ -65,7 +66,7 @@ FOR i IN 1..1000
|
|||
} INTO users OPTIONS { waitForSync: true }
|
||||
```
|
||||
|
||||
!SUBSECTION Returning the inserted documents
|
||||
### Returning the inserted documents
|
||||
|
||||
The inserted documents can also be returned by the query. In this case, the `INSERT`
|
||||
statement can be a `RETURN` statement (intermediate `LET` statements are allowed, too).
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER LET
|
||||
LET
|
||||
===
|
||||
|
||||
The *LET* statement can be used to assign an arbitrary value to a variable.
|
||||
The variable is then introduced in the scope the *LET* statement is placed in.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER LIMIT
|
||||
LIMIT
|
||||
=====
|
||||
|
||||
The *LIMIT* statement allows slicing the result array using an
|
||||
offset and a count. It reduces the number of elements in the result to at most
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER High-level operations
|
||||
High-level operations
|
||||
=====================
|
||||
|
||||
The following high-level operations are described here after:
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
!CHAPTER REMOVE
|
||||
REMOVE
|
||||
======
|
||||
|
||||
The *REMOVE* keyword can be used to remove documents from a collection. On a
|
||||
single server, the document removal is executed transactionally in an
|
||||
|
@ -49,7 +50,7 @@ FOR u IN users
|
|||
REMOVE { _key: u._key } IN backup
|
||||
```
|
||||
|
||||
!SUBSECTION Setting query options
|
||||
### Setting query options
|
||||
|
||||
*options* can be used to suppress query errors that may occur when trying to
|
||||
remove non-existing documents. For example, the following query will fail if one
|
||||
|
@ -76,7 +77,7 @@ FOR i IN 1..1000
|
|||
REMOVE { _key: CONCAT('test', i) } IN users OPTIONS { waitForSync: true }
|
||||
```
|
||||
|
||||
!SUBSECTION Returning the removed documents
|
||||
### Returning the removed documents
|
||||
|
||||
The removed documents can also be returned by the query. In this case, the `REMOVE`
|
||||
statement must be followed by a `RETURN` statement (intermediate `LET` statements
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER REPLACE
|
||||
REPLACE
|
||||
=======
|
||||
|
||||
The *REPLACE* keyword can be used to completely replace documents in a collection. On a
|
||||
single server, the replace operation is executed transactionally in an all-or-nothing
|
||||
|
@ -71,7 +72,7 @@ FOR u IN users
|
|||
REPLACE u WITH { status: 'inactive', name: u.name } IN backup
|
||||
```
|
||||
|
||||
!SUBSECTION Setting query options
|
||||
### Setting query options
|
||||
|
||||
*options* can be used to suppress query errors that may occur when trying to
|
||||
replace non-existing documents or when violating unique key constraints:
|
||||
|
@ -89,7 +90,7 @@ FOR i IN 1..1000
|
|||
REPLACE { _key: CONCAT('test', i) } WITH { foobar: true } IN users OPTIONS { waitForSync: true }
|
||||
```
|
||||
|
||||
!SUBSECTION Returning the modified documents
|
||||
### Returning the modified documents
|
||||
|
||||
The modified documents can also be returned by the query. In this case, the `REPLACE`
|
||||
statement must be followed by a `RETURN` statement (intermediate `LET` statements are
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER RETURN
|
||||
RETURN
|
||||
======
|
||||
|
||||
The *RETURN* statement can be used to produce the result of a query.
|
||||
It is mandatory to specify a *RETURN* statement at the end of each block in a
|
||||
|
@ -103,7 +104,7 @@ FOR u IN users
|
|||
]
|
||||
```
|
||||
|
||||
!SUBSECTION RETURN DISTINCT
|
||||
### RETURN DISTINCT
|
||||
|
||||
Since ArangoDB 2.7, *RETURN* can optionally be followed by the *DISTINCT* keyword.
|
||||
The *DISTINCT* keyword will ensure uniqueness of the values returned by the
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
!CHAPTER SORT
|
||||
SORT
|
||||
====
|
||||
|
||||
The *SORT* statement will force a sort of the array of already produced
|
||||
intermediate results in the current block. *SORT* allows specifying one or
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER UPDATE
|
||||
UPDATE
|
||||
======
|
||||
|
||||
The *UPDATE* keyword can be used to partially update documents in a collection. On a
|
||||
single server, updates are executed transactionally in an all-or-nothing fashion.
|
||||
|
@ -65,7 +66,7 @@ FOR u IN users
|
|||
UPDATE u WITH { status: 'inactive' } IN backup
|
||||
```
|
||||
|
||||
!SUBSECTION Using the current value of a document attribute
|
||||
### Using the current value of a document attribute
|
||||
|
||||
The pseudo-variable `OLD` is not supported inside of `WITH` clauses (it is
|
||||
available after `UPDATE`). To access the current attribute value, you can
|
||||
|
@ -121,7 +122,7 @@ UPDATE doc WITH {
|
|||
If the attribute `hobbies` doesn't exist yet, it is conveniently initialized
|
||||
as `[ "swimming" ]` and otherwise extended.
|
||||
|
||||
!SUBSECTION Setting query options
|
||||
### Setting query options
|
||||
|
||||
*options* can be used to suppress query errors that may occur when trying to
|
||||
update non-existing documents or violating unique key constraints:
|
||||
|
@ -197,7 +198,7 @@ FOR u IN users
|
|||
} IN users OPTIONS { waitForSync: true }
|
||||
```
|
||||
|
||||
!SUBSECTION Returning the modified documents
|
||||
### Returning the modified documents
|
||||
|
||||
The modified documents can also be returned by the query. In this case, the `UPDATE`
|
||||
statement needs to be followed a `RETURN` statement (intermediate `LET` statements
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER UPSERT
|
||||
UPSERT
|
||||
======
|
||||
|
||||
The *UPSERT* keyword can be used for checking whether certain documents exist,
|
||||
and to update/replace them in case they exist, or create them in case they do not exist.
|
||||
|
@ -52,7 +53,7 @@ Note that in the *UPDATE* case it is possible to refer to the previous version o
|
|||
document using the *OLD* pseudo-value.
|
||||
|
||||
|
||||
!SUBSECTION Setting query options
|
||||
### Setting query options
|
||||
|
||||
As in several above examples, the *ignoreErrors* option can be used to suppress query
|
||||
errors that may occur when trying to violate unique key constraints.
|
||||
|
@ -72,7 +73,7 @@ To make sure data are durable when an update query returns, there is the *waitFo
|
|||
query option.
|
||||
|
||||
|
||||
!SUBSECTION Returning documents
|
||||
### Returning documents
|
||||
|
||||
`UPSERT` statements can optionally return data. To do so, they need to be followed
|
||||
by a `RETURN` statement (intermediate `LET` statements are allowed, too). These statements
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
!CHAPTER WITH
|
||||
WITH
|
||||
====
|
||||
|
||||
An AQL query can optionally start with a *WITH* statement and the list of
|
||||
collections used by the query. All collections specified in *WITH* will be
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
!CHAPTER Operators
|
||||
Operators
|
||||
=========
|
||||
|
||||
AQL supports a number of operators that can be used in expressions. There are
|
||||
comparison, logical, arithmetic, and the ternary operator.
|
||||
|
||||
!SUBSUBSECTION Comparison operators
|
||||
#### Comparison operators
|
||||
|
||||
Comparison (or relational) operators compare two operands. They can be used with
|
||||
any input data types, and will return a boolean result value.
|
||||
|
@ -74,7 +75,7 @@ be strings, and their right-hand operands to be strings containing valid regular
|
|||
expressions as specified in the documentation for the AQL function
|
||||
[REGEX_TEST()](Functions/String.md#regextest).
|
||||
|
||||
!SUBSUBSECTION Array comparison operators
|
||||
#### Array comparison operators
|
||||
|
||||
The comparison operators also exist as *array variant*. In the array
|
||||
variant, the operator is prefixed with one of the keywords *ALL*, *ANY*
|
||||
|
@ -108,7 +109,7 @@ Examples:
|
|||
|
||||
Note that these operators are not optimized yet. Indexes will not be utilized.
|
||||
|
||||
!SUBSUBSECTION Logical operators
|
||||
#### Logical operators
|
||||
|
||||
The following logical operators are supported in AQL:
|
||||
|
||||
|
@ -178,7 +179,7 @@ null && true // null
|
|||
true && 23 // 23
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Arithmetic operators
|
||||
#### Arithmetic operators
|
||||
|
||||
Arithmetic operators perform an arithmetic operation on two numeric
|
||||
operands. The result of an arithmetic operation is again a numeric value.
|
||||
|
@ -256,7 +257,7 @@ null + 1 // 1
|
|||
1 / 0 // 0
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Ternary operator
|
||||
#### Ternary operator
|
||||
|
||||
AQL also supports a ternary operator that can be used for conditional
|
||||
evaluation. The ternary operator expects a boolean condition as its first
|
||||
|
@ -269,7 +270,7 @@ evaluates to true, and the third operand otherwise.
|
|||
u.age > 15 || u.active == true ? u.userId : null
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Range operator
|
||||
#### Range operator
|
||||
|
||||
AQL supports expressing simple numeric ranges with the *..* operator.
|
||||
This operator can be used to easily iterate over a sequence of numeric
|
||||
|
@ -292,13 +293,13 @@ will produce the following result:
|
|||
|
||||
There is also a [RANGE() function](Functions/Numeric.md#range).
|
||||
|
||||
!SUBSUBSECTION Array operators
|
||||
#### Array operators
|
||||
|
||||
AQL provides array operators <i>[\*]</i> for
|
||||
[array variable expansion](Advanced/ArrayOperators.md#array-expansion) and
|
||||
<i>[\*\*]</i> for [array contraction](Advanced/ArrayOperators.md#array-contraction).
|
||||
|
||||
!SUBSUBSECTION Operator precedence
|
||||
#### Operator precedence
|
||||
|
||||
The operator precedence in AQL is similar as in other familiar languages (lowest precedence first):
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Introduction
|
||||
Introduction
|
||||
============
|
||||
|
||||
The ArangoDB query language (AQL) can be used to retrieve and modify data that
|
||||
are stored in ArangoDB. The general workflow when executing a query is as follows:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Administration and Monitoring
|
||||
HTTP Interface for Administration and Monitoring
|
||||
================================================
|
||||
|
||||
|
||||
This is an introduction to ArangoDB's HTTP interface for administration and
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER HTTP Interface for Agency feature
|
||||
HTTP Interface for Agency feature
|
||||
=================================
|
||||
|
||||
!SUBSECTION Configuration
|
||||
### Configuration
|
||||
|
||||
At all times, i.e. regardless of the state of the agents and the current health of the RAFT consensus, one can invoke the configuration API:
|
||||
|
||||
|
@ -47,7 +48,7 @@ This is the actual output of a healthy agency. The configuration of the agency i
|
|||
|
||||
The remaining data reflect the variant entities in RAFT, as `term` and `leaderId`, also some debug information on how long the last leadership vote was received from any particular agency member. Low term numbers on a healthy network are an indication of good operation environemnt, while often increasing term numbers indicate, that the network environemnt and stability suggest to raise the RAFT parameters `min ping` and 'max ping' accordingly.
|
||||
|
||||
!SUBSECTION Key-Value store APIs
|
||||
### Key-Value store APIs
|
||||
|
||||
Generally, all document IO to and from the key-value store consists of JSON arrays. The outer Array is an envelope for multiple read or write transactions. The results are arrays are an envelope around the results corresponding to the order of the incoming transactions.
|
||||
|
||||
|
@ -87,7 +88,7 @@ The read access is a complete access to the key-value store indicated by access
|
|||
|
||||
Let's dig in some deeper.
|
||||
|
||||
!SUBSECTION Read API
|
||||
### Read API
|
||||
|
||||
Let's start with the above initialised key-value store in the following. Let us visit the following read operations:
|
||||
|
||||
|
@ -198,7 +199,7 @@ curl -L http://server:port/read -d '[["/a/b/c"],["/a/b/d"],["/a/x/y"],["/y"],["/
|
|||
|
||||
```
|
||||
|
||||
!SUBSECTION Write API
|
||||
### Write API
|
||||
|
||||
The write API must obviously be more versatile and needs a more detailed appreciation. Write operations are arrays of transactions with preconditions, i.e. `[[U,P]]`, where the system tries to apply all updates in the outer array in turn, rejecting those whose precondition is not fulfilled by the current state. It is guaranteed that the transactions in the write request are sequenced adjacent to each other (with no intervention from other write requests). Only the ones with failed preconditions are left out.
|
||||
|
||||
|
@ -328,7 +329,7 @@ appends the string `"Max"` to the end of the list stored in the `"z"` attribute,
|
|||
```
|
||||
removes the last entry of the array stored under `"u"`, if the value of `"u"` is not set or not an array.
|
||||
|
||||
!SUBSECTION HTTP-headers for write operations
|
||||
### HTTP-headers for write operations
|
||||
|
||||
`X-ArangoDB-Agency-Mode` with possible values `"waitForCommitted"`, `"waitForSequenced"` and `"noWait"`.
|
||||
|
||||
|
@ -338,7 +339,7 @@ In the last case, `"noWait"`, the operation returns immediately, an empty body i
|
|||
|
||||
`X-ArangoDB-Agency-Tag` with an arbitrary UTF-8 string value.
|
||||
|
||||
!SUBSECTION Observers
|
||||
### Observers
|
||||
|
||||
External services to the agency may announce themselves or others to be observers of arbitrary existing or future keys in the key-value-store. The agency must then inform the observing service of any changes to the subtree below the observed key. The notification is done by virtue of POST requests to a required valid URL.
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface
|
||||
HTTP Interface
|
||||
==============
|
||||
|
||||
Following you have ArangoDB's HTTP Interface for Documents, Databases, Edges and more.
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER HTTP Interface for AQL Queries
|
||||
HTTP Interface for AQL Queries
|
||||
==============================
|
||||
|
||||
!SUBSECTION Explaining and parsing queries
|
||||
### Explaining and parsing queries
|
||||
|
||||
ArangoDB has an HTTP interface to syntactically validate AQL queries.
|
||||
Furthermore, it offers an HTTP interface to retrieve the execution plan for any
|
||||
|
@ -15,7 +16,7 @@ inspect it and return meta information about it.
|
|||
|
||||
@startDocuBlock PostApiQueryProperties
|
||||
|
||||
!SUBSECTION Query tracking
|
||||
### Query tracking
|
||||
|
||||
ArangoDB has an HTTP interface for retrieving the lists of currently
|
||||
executing AQL queries and the list of slow AQL queries. In order to make meaningful
|
||||
|
@ -37,7 +38,7 @@ request is executed for.
|
|||
<!--arangod/RestHandler/RestQueryHandler.cpp -->
|
||||
@startDocuBlock DeleteApiQuerySlow
|
||||
|
||||
!SUBSECTION Killing queries
|
||||
### Killing queries
|
||||
|
||||
Running AQL queries can also be killed on the server. ArangoDB provides a kill facility
|
||||
via an HTTP interface. To kill a running query, its id (as returned for the query in the
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for the AQL query cache
|
||||
HTTP Interface for the AQL query cache
|
||||
======================================
|
||||
|
||||
This section describes the API methods for controlling the AQL query cache.
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Accessing Cursors via HTTP
|
||||
Accessing Cursors via HTTP
|
||||
==========================
|
||||
|
||||
<!-- js/actions/api-cursor.js -->
|
||||
@startDocuBlock JSF_post_api_cursor
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Retrieving query results
|
||||
Retrieving query results
|
||||
========================
|
||||
|
||||
Select queries are executed on-the-fly on the server and the result
|
||||
set will be returned back to the client.
|
||||
|
@ -8,7 +9,7 @@ There are two ways the client can get the result set from the server:
|
|||
* In a single roundtrip
|
||||
* Using a cursor
|
||||
|
||||
!SUBSECTION Single roundtrip
|
||||
### Single roundtrip
|
||||
|
||||
The server will only transfer a certain number of result documents back to the
|
||||
client in one roundtrip. This number is controllable by the client by setting
|
||||
|
@ -49,7 +50,7 @@ Content-type: application/json
|
|||
}
|
||||
```
|
||||
|
||||
!SUBSECTION Using a cursor
|
||||
### Using a cursor
|
||||
|
||||
If the result set contains more documents than should be transferred in a single
|
||||
roundtrip (i.e. as set via the *batchSize* attribute), the server will return
|
||||
|
@ -164,7 +165,7 @@ Content-type: application/json
|
|||
}
|
||||
```
|
||||
|
||||
!SUBSECTION Modifying documents
|
||||
### Modifying documents
|
||||
|
||||
The `_api/cursor` endpoint can also be used to execute modifying queries.
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER HTTP Interface for AQL Query Cursors
|
||||
HTTP Interface for AQL Query Cursors
|
||||
====================================
|
||||
|
||||
!SUBSECTION Database Cursors
|
||||
### Database Cursors
|
||||
|
||||
This is an introduction to ArangoDB's HTTP Interface for Queries. Results of AQL
|
||||
and simple queries are returned as cursors in order to batch the communication
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER HTTP Interface for AQL User Functions Management
|
||||
HTTP Interface for AQL User Functions Management
|
||||
================================================
|
||||
|
||||
!SUBSECTION AQL User Functions Management
|
||||
### AQL User Functions Management
|
||||
|
||||
This is an introduction to ArangoDB's HTTP interface for managing AQL
|
||||
user functions. AQL user functions are a means to extend the functionality
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
!CHAPTER HTTP Interface for Async Results Management
|
||||
!SUBSECTION Request Execution
|
||||
HTTP Interface for Async Results Management
|
||||
===========================================
|
||||
### Request Execution
|
||||
|
||||
ArangoDB provides various methods of executing client requests. Clients can choose the appropriate method on a per-request level based on their throughput, control flow, and durability requirements.
|
||||
|
||||
!SUBSUBSECTION Blocking execution
|
||||
#### Blocking execution
|
||||
|
||||
ArangoDB is a multi-threaded server, allowing the processing of multiple client
|
||||
requests at the same time. Communication handling and the actual work can be performed
|
||||
|
@ -24,7 +25,7 @@ Thus closing the connection does not help to abort a long running query!
|
|||
See below under [Async Execution and later Result Retrieval](#async-execution-and-later-result-retrieval)
|
||||
and [HttpJobPutCancel](#managing-async-results-via-http) for details.
|
||||
|
||||
!SUBSUBSECTION Fire and Forget
|
||||
#### Fire and Forget
|
||||
|
||||
To mitigate client blocking issues, ArangoDB since version 1.4. offers a generic mechanism
|
||||
for non-blocking requests: if clients add the HTTP header *x-arango-async: true* to their
|
||||
|
@ -56,7 +57,7 @@ If you need to cancel requests,
|
|||
use [Async Execution and later Result Retrieval](#async-execution-and-later-result-retrieval)
|
||||
and [HttpJobPutCancel](#managing-async-results-via-http) below.
|
||||
|
||||
!SUBSUBSECTION Async Execution and later Result Retrieval
|
||||
#### Async Execution and later Result Retrieval
|
||||
|
||||
By adding the HTTP header *x-arango-async: store* to a request, clients can instruct
|
||||
the ArangoDB server to execute the operation asynchronously as [above](#fire-and-forget),
|
||||
|
@ -87,7 +88,7 @@ from time to time.
|
|||
The job queue and the results are kept in memory only on the server, so they will be
|
||||
lost in case of a crash.
|
||||
|
||||
!SUBSUBSECTION Canceling asynchronous jobs
|
||||
#### Canceling asynchronous jobs
|
||||
|
||||
As mentioned above it is possible to cancel an asynchronously running
|
||||
job using its job ID. This is done with a PUT request as described in
|
||||
|
@ -109,14 +110,15 @@ then only the code running on the coordinator is stopped, there may
|
|||
remain tasks within the cluster which have already been distributed to
|
||||
the DBservers and it is currently not possible to cancel them as well.
|
||||
|
||||
!SUBSUBSECTION Async Execution and Authentication
|
||||
#### Async Execution and Authentication
|
||||
|
||||
If a request requires authentication, the authentication procedure is run before
|
||||
queueing. The request will only be queued if it valid credentials and the authentication
|
||||
succeeds. If the request does not contain valid credentials, it will not be queued but
|
||||
rejected instantly in the same way as a "regular", non-queued request.
|
||||
|
||||
!CHAPTER Managing Async Results via HTTP
|
||||
Managing Async Results via HTTP
|
||||
===============================
|
||||
|
||||
@startDocuBlock JSF_job_fetch_result
|
||||
@startDocuBlock JSF_job_cancel
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Batch Requests
|
||||
HTTP Interface for Batch Requests
|
||||
=================================
|
||||
|
||||
Clients normally send individual operations to ArangoDB in individual
|
||||
HTTP requests. This is straightforward and simple, but has the
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Importing Headers and Values
|
||||
Importing Headers and Values
|
||||
============================
|
||||
|
||||
When using this type of import, the attribute names of the documents to be
|
||||
imported are specified separate from the actual document value data. The first
|
||||
|
@ -34,7 +35,8 @@ also contain an attribute *details* which is an array of details about errors th
|
|||
occurred on the server side during the import. This array might be empty if no
|
||||
errors occurred.
|
||||
|
||||
!SECTION Importing into Edge Collections
|
||||
Importing into Edge Collections
|
||||
-------------------------------
|
||||
|
||||
Please note that when importing documents into an
|
||||
[edge collection](../../Manual/Appendix/Glossary.html#edge-collection),
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Importing Self-Contained JSON Documents
|
||||
Importing Self-Contained JSON Documents
|
||||
=======================================
|
||||
|
||||
This import method allows uploading self-contained JSON documents. The documents
|
||||
must be uploaded in the body of the HTTP POST request. Each line of the body
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Bulk Imports
|
||||
HTTP Interface for Bulk Imports
|
||||
===============================
|
||||
|
||||
ArangoDB provides an HTTP interface to import multiple documents at once into a
|
||||
collection. This is known as a bulk import.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Creating and Deleting Collections
|
||||
Creating and Deleting Collections
|
||||
=================================
|
||||
|
||||
|
||||
<!-- js/actions/api-collection.js -->
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Getting Information about a Collection
|
||||
Getting Information about a Collection
|
||||
======================================
|
||||
|
||||
<!-- js/actions/api-collection.js -->
|
||||
@startDocuBlock JSA_get_api_collection_name
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Modifying a Collection
|
||||
Modifying a Collection
|
||||
======================
|
||||
|
||||
<!-- js/actions/api-collection.js -->
|
||||
@startDocuBlock JSF_put_api_collection_load
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
!CHAPTER HTTP Interface for Collections
|
||||
HTTP Interface for Collections
|
||||
==============================
|
||||
|
||||
!SUBSECTION Collections
|
||||
### Collections
|
||||
|
||||
This is an introduction to ArangoDB's HTTP interface for collections.
|
||||
|
||||
!SUBSUBSECTION Collection
|
||||
#### Collection
|
||||
|
||||
A collection consists of documents. It is uniquely identified by its
|
||||
[collection identifier](../../Manual/Appendix/Glossary.html#collection-identifier).
|
||||
|
@ -15,7 +16,7 @@ Collections have a type that is specified by the user when the collection
|
|||
is created. There are currently two types: document and edge. The default
|
||||
type is document.
|
||||
|
||||
!SUBSUBSECTION Collection Identifier
|
||||
#### Collection Identifier
|
||||
|
||||
A collection identifier lets you refer to a collection in a database.
|
||||
It is a string value and is unique within the database. Up to including
|
||||
|
@ -32,7 +33,7 @@ or use it locally.
|
|||
|
||||
Note: collection ids have been returned as integers up to including ArangoDB 1.1
|
||||
|
||||
!SUBSUBSECTION Collection Name
|
||||
#### Collection Name
|
||||
|
||||
A collection name identifies a collection in a database. It is a string
|
||||
and is unique within the database. Unlike the collection identifier it is
|
||||
|
@ -41,7 +42,7 @@ of letters, digits, and the _ (underscore) and - (dash) characters only.
|
|||
Please refer to Naming Conventions in ArangoDB for more information on valid
|
||||
collection names.
|
||||
|
||||
!SUBSUBSECTION Key Generator
|
||||
#### Key Generator
|
||||
|
||||
ArangoDB allows using key generators for each collection. Key generators
|
||||
have the purpose of auto-generating values for the _key attribute of a document
|
||||
|
@ -64,7 +65,8 @@ When creating a collection with the auto increment key generator and an incremen
|
|||
The basic operations (create, read, update, delete) for documents are mapped
|
||||
to the standard HTTP methods (*POST*, *GET*, *PUT*, *DELETE*).
|
||||
|
||||
!SECTION Address of a Collection
|
||||
Address of a Collection
|
||||
-----------------------
|
||||
|
||||
All collections in ArangoDB have an unique identifier and a unique
|
||||
name. ArangoDB internally uses the collection's unique identifier to
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Database-to-Endpoint Mapping
|
||||
Database-to-Endpoint Mapping
|
||||
============================
|
||||
|
||||
If a [database name](../../Manual/Appendix/Glossary.html#database-name) is present in the
|
||||
URI as above, ArangoDB will consult the database-to-endpoint mapping for the current
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Database Management
|
||||
Database Management
|
||||
===================
|
||||
|
||||
This is an introduction to ArangoDB's HTTP interface for managing databases.
|
||||
|
||||
|
@ -10,7 +11,8 @@ databases.
|
|||
Please note that all database management operations can only be accessed via
|
||||
the default database (*_system*) and none of the other databases.
|
||||
|
||||
!SECTION Managing Databases using HTTP
|
||||
Managing Databases using HTTP
|
||||
-----------------------------
|
||||
|
||||
<!-- js/actions/api-database.js -->
|
||||
@startDocuBlock JSF_get_api_database_current
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Notes on Databases
|
||||
Notes on Databases
|
||||
==================
|
||||
|
||||
Please keep in mind that each database contains its own system collections,
|
||||
which need to set up when a database is created. This will make the creation
|
||||
|
@ -10,7 +11,7 @@ in. A new database will only provide access to the system applications shipped
|
|||
with ArangoDB (that is the web interface at the moment) and no other Foxx
|
||||
applications until they are explicitly installed for the particular database.
|
||||
|
||||
!SUBSECTION Database
|
||||
### Database
|
||||
|
||||
ArangoDB can handle multiple databases in the same server instance. Databases can be used to logically group and separate data. An ArangoDB database consists of collections and dedicated database-specific worker processes.
|
||||
A database contains its own collections (which cannot be accessed from other databases), Foxx applications and replication loggers and appliers. Each ArangoDB database contains its own system collections (e.g. _users, _graphs, ...).
|
||||
|
@ -19,12 +20,12 @@ There will always be at least one database in ArangoDB. This is the default [dat
|
|||
|
||||
When ArangoDB is accessed via its HTTP REST API, the database name is read from the first part of the request URI path (e.g. /_db/_system/...). If the request URI does not contain a database name, the database name is automatically determined by the algorithm described in Database-to-Endpoint Mapping .
|
||||
|
||||
!SUBSECTION Database Name
|
||||
### Database Name
|
||||
|
||||
A single ArangoDB instance can handle multiple databases in parallel. When multiple databases are used, each database must be given an unique name. This name is used to uniquely identify a database. The default database in ArangoDB is named _system.
|
||||
The database name is a string consisting of only letters, digits and the _ (underscore) and - (dash) characters. User-defined database names must always start with a letter. Database names are case-sensitive.
|
||||
|
||||
!SUBSECTION Database Organization
|
||||
### Database Organization
|
||||
|
||||
A single ArangoDB instance can handle multiple databases in parallel. By default, there will be at least one database which is named _system.
|
||||
Databases are physically stored in separate sub-directories underneath the database directory, which itself resides in the instance's data directory.
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER HTTP Interface for Databases
|
||||
HTTP Interface for Databases
|
||||
============================
|
||||
|
||||
!SUBSECTION Address of a Database
|
||||
### Address of a Database
|
||||
|
||||
Any operation triggered via ArangoDB's HTTP REST API is executed in the context of exactly
|
||||
one database. To explicitly specify the database in a request, the request URI must contain
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
!CHAPTER Basics and Terminology
|
||||
Basics and Terminology
|
||||
======================
|
||||
|
||||
!SUBSECTION Documents, Keys, Handles and Revisions
|
||||
### Documents, Keys, Handles and Revisions
|
||||
|
||||
Documents in ArangoDB are JSON objects. These objects can be nested (to
|
||||
any depth) and may contain lists. Each document has a unique
|
||||
|
@ -45,14 +46,14 @@ creating a document. `_id` and `_key` values are immutable once the document
|
|||
has been created. The `_rev` value is maintained by ArangoDB automatically.
|
||||
|
||||
|
||||
!SUBSECTION Document Handle
|
||||
### Document Handle
|
||||
|
||||
A document handle uniquely identifies a document in the database. It
|
||||
is a string and consists of the collection's name and the document key
|
||||
(`_key` attribute) separated by `/`.
|
||||
|
||||
|
||||
!SUBSECTION Document Key
|
||||
### Document Key
|
||||
|
||||
A document key uniquely identifies a document in the collection it is
|
||||
stored in. It can and should be used by clients when specific documents
|
||||
|
@ -72,7 +73,7 @@ completely, or to force a specific regime for auto-generating the `_key`
|
|||
values.
|
||||
|
||||
|
||||
!SUBSECTION Document Revision
|
||||
### Document Revision
|
||||
|
||||
As ArangoDB supports MVCC (Multiple Version Concurrency Control),
|
||||
documents can exist in more than one
|
||||
|
@ -99,7 +100,7 @@ to check if a document revision is older than one another, even if this
|
|||
might work for some cases.
|
||||
|
||||
|
||||
!SUBSECTION Document Etag
|
||||
### Document Etag
|
||||
|
||||
ArangoDB tries to adhere to the existing HTTP standard as far as
|
||||
possible. To this end, results of single document queries have the HTTP
|
||||
|
@ -113,7 +114,7 @@ If you modify a document, you can use the *If-Match* field to detect conflicts.
|
|||
The revision of a document can be checking using the HTTP method *HEAD*.
|
||||
|
||||
|
||||
!SUBSECTION Multiple Documents in a single Request
|
||||
### Multiple Documents in a single Request
|
||||
|
||||
Beginning with ArangoDB 3.0 the basic document API has been extended
|
||||
to handle not only single documents but multiple documents in a single
|
||||
|
@ -136,7 +137,7 @@ endpoints to request and delete multiple documents in one request.
|
|||
FIXME: ADD SENSIBLE LINKS HERE.
|
||||
|
||||
|
||||
!SUBSECTION URI of a Document
|
||||
### URI of a Document
|
||||
|
||||
Any document can be retrieved using its unique URI:
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Documents
|
||||
HTTP Interface for Documents
|
||||
============================
|
||||
|
||||
In this chapter we describe the REST API of ArangoDB for documents.
|
||||
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
!CHAPTER Working with Documents using REST
|
||||
Working with Documents using REST
|
||||
=================================
|
||||
|
||||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_READ
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The *rev* query parameter has been withdrawn. The same effect can be
|
||||
achieved with the *If-Match* HTTP header.
|
||||
|
@ -11,7 +12,7 @@ achieved with the *If-Match* HTTP header.
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_READ_HEAD
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The *rev* query parameter has been withdrawn. The same effect can be
|
||||
achieved with the *If-Match* HTTP header.
|
||||
|
@ -19,7 +20,7 @@ achieved with the *If-Match* HTTP header.
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_READ_ALL
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The collection name should now be specified in the URL path. The old
|
||||
way with the URL path */_api/document* and the required query parameter
|
||||
|
@ -28,7 +29,7 @@ way with the URL path */_api/document* and the required query parameter
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_CREATE
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The collection name should now be specified in the URL path. The old
|
||||
way with the URL path */_api/document* and the required query parameter
|
||||
|
@ -39,7 +40,7 @@ with one operation is new and the query parameter *returnNew* has been added.
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_REPLACE
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
There are quite some changes in this in comparison to Version 2.8, but
|
||||
few break existing usage:
|
||||
|
@ -63,14 +64,14 @@ way with the URL path */_api/document* and the required query parameter
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_REPLACE_MULTI
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The multi document version is new in 3.0.
|
||||
|
||||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_UPDATE
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
There are quite some changes in this in comparison to Version 2.8, but
|
||||
few break existing usage:
|
||||
|
@ -94,14 +95,14 @@ way with the URL path */_api/document* and the required query parameter
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_UPDATE_MULTI
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
The multi document version is new in 3.0.
|
||||
|
||||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_DELETE
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
There are only very few changes in this in comparison to Version 2.8:
|
||||
|
||||
|
@ -118,7 +119,7 @@ easily be achieved by leaving out the *If-Match* header.
|
|||
<!-- arangod/RestHandler/RestDocumentHandler.cpp -->
|
||||
@startDocuBlock REST_DOCUMENT_DELETE_MULTI
|
||||
|
||||
!SUBSUBSECTION Changes in 3.0 from 2.8:
|
||||
#### Changes in 3.0 from 2.8:
|
||||
|
||||
This variant is new in 3.0. Note that it requires a body in the DELETE
|
||||
request.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Address and ETag of an Edge
|
||||
Address and ETag of an Edge
|
||||
===========================
|
||||
|
||||
All documents in ArangoDB have a [document handle](../../Manual/Appendix/Glossary.html#document-handle). This handle uniquely identifies
|
||||
a document. Any document can be retrieved using its unique URI:
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Edges
|
||||
HTTP Interface for Edges
|
||||
========================
|
||||
|
||||
This is an introduction to ArangoDB's [REST interface for edges](../../Manual/Graphs/Edges/index.html).
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Working with Edges using REST
|
||||
Working with Edges using REST
|
||||
=============================
|
||||
|
||||
This is documentation to ArangoDB's
|
||||
[REST interface for edges](../../Manual/Graphs/Edges/index.html).
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER HTTP Interface for Endpoints
|
||||
HTTP Interface for Endpoints
|
||||
============================
|
||||
|
||||
The ArangoDB server can listen for incoming requests on multiple *endpoints*.
|
||||
|
||||
|
@ -21,7 +22,8 @@ be used to update existing endpoints or remove them at runtime.
|
|||
Please note that all endpoint management operations can only be accessed via
|
||||
the default database (*_system*) and none of the other databases.
|
||||
|
||||
!SECTION Managing Endpoints via HTTP
|
||||
Managing Endpoints via HTTP
|
||||
---------------------------
|
||||
|
||||
<!-- js/actions/api-endpoint.js -->
|
||||
@startDocuBlock JSF_get_api_endpoint
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
!CHAPTER HTTP Interface for Exporting Documents
|
||||
HTTP Interface for Exporting Documents
|
||||
======================================
|
||||
|
||||
@startDocuBlock JSF_post_api_export
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
!CHAPTER General HTTP Request Handling in ArangoDB
|
||||
General HTTP Request Handling in ArangoDB
|
||||
=========================================
|
||||
|
||||
!SECTION Protocol
|
||||
Protocol
|
||||
--------
|
||||
|
||||
ArangoDB exposes its API via HTTP, making the server accessible easily with
|
||||
a variety of clients and tools (e.g. browsers, curl, telnet). The communication
|
||||
|
@ -27,7 +29,8 @@ correct content length in every request that can have a body (e.g. *POST*,
|
|||
*Content-Length* header - thus chunked transfer encoding for POST-documents
|
||||
is not supported.
|
||||
|
||||
!SECTION HTTP Keep-Alive
|
||||
HTTP Keep-Alive
|
||||
---------------
|
||||
|
||||
ArangoDB supports HTTP keep-alive. If the client does not send a *Connection*
|
||||
header in its request, and the client uses HTTP version 1.1, ArangoDB will assume
|
||||
|
@ -50,7 +53,8 @@ to build up a so called *connection pool* with several established
|
|||
connections in your client application, and dynamically re-use
|
||||
one of those then idle connections for subsequent requests.
|
||||
|
||||
!SECTION Blocking vs. Non-blocking HTTP Requests
|
||||
Blocking vs. Non-blocking HTTP Requests
|
||||
---------------------------------------
|
||||
|
||||
ArangoDB supports both blocking and non-blocking HTTP requests.
|
||||
|
||||
|
@ -102,7 +106,8 @@ result of the request they send.
|
|||
For details on the subsequent processing
|
||||
[read on under Async Result handling](../AsyncResultsManagement/README.md).
|
||||
|
||||
!SECTION Authentication
|
||||
Authentication
|
||||
--------------
|
||||
|
||||
Client authentication can be achieved by using the *Authorization* HTTP header in
|
||||
client requests. ArangoDB supports authentication via HTTP Basic or JWT.
|
||||
|
@ -145,7 +150,7 @@ to ArangoDB, ArangoDB will only send status code 401, but no *WWW-Authenticate*
|
|||
This allows clients to implement credentials handling and bypassing the browser's
|
||||
built-in dialog.
|
||||
|
||||
!SUBSECTION Authentication via JWT
|
||||
### Authentication via JWT
|
||||
|
||||
To authenticate via JWT you must first obtain a JWT. To do so send a POST request to
|
||||
|
||||
|
@ -175,7 +180,8 @@ ArangoDB uses a standard JWT authentication. The secret may either be set using
|
|||
|
||||
For more information on JWT please consult RFC7519 and https://jwt.io
|
||||
|
||||
!SECTION Error Handling
|
||||
Error Handling
|
||||
--------------
|
||||
|
||||
The following should be noted about how ArangoDB handles client errors in its
|
||||
HTTP layer:
|
||||
|
@ -224,7 +230,8 @@ HTTP layer:
|
|||
Requests using any other HTTP method (such as for example CONNECT, TRACE etc.)
|
||||
will be rejected by ArangoDB as mentioned before.
|
||||
|
||||
!SECTION Cross Origin Resource Sharing (CORS) requests
|
||||
Cross Origin Resource Sharing (CORS) requests
|
||||
---------------------------------------------
|
||||
|
||||
ArangoDB will automatically handle CORS requests as follows:
|
||||
|
||||
|
@ -270,7 +277,8 @@ The response to the HTTP OPTIONS request will however be a generic response that
|
|||
will not expose any private data and thus can be considered "safe" even without
|
||||
credentials.
|
||||
|
||||
!SECTION HTTP method overriding
|
||||
HTTP method overriding
|
||||
----------------------
|
||||
|
||||
ArangoDB provides a startup option *--http.allow-method-override*.
|
||||
This option can be set to allow overriding the HTTP request method (e.g. GET, POST,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Handling Edges
|
||||
Handling Edges
|
||||
==============
|
||||
|
||||
Examples will explain the REST API for [manipulating edges](../../Manual/Graphs/GeneralGraphs/Functions.html)
|
||||
of the [graph module](../../Manual/Graphs/index.html) on the [knows graph](../../Manual/Graphs/index.html#the-knowsgraph):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Manage your graphs
|
||||
Manage your graphs
|
||||
==================
|
||||
|
||||
The [graph module](../../Manual/Graphs/index.html) provides functions dealing with graph structures.
|
||||
Examples will explain the REST API on the [social graph](../../Manual/Graphs/index.html#the-social-graph):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER General Graphs
|
||||
General Graphs
|
||||
==============
|
||||
|
||||
This chapter describes the REST interface for the [multi-collection graph module](../../Manual/Graphs/index.html).
|
||||
It allows you to define a graph that is spread across several edge and document collections.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Handling Vertices
|
||||
Handling Vertices
|
||||
=================
|
||||
|
||||
Examples will explain the REST API to the [graph module](../../Manual/Graphs/index.html)
|
||||
on the [social graph](../../Manual/Graphs/index.html#the-social-graph):
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Fulltext
|
||||
Fulltext
|
||||
========
|
||||
|
||||
If a [fulltext index](../../Manual/Appendix/Glossary.html#fulltext-index) exists, then
|
||||
/_api/simple/fulltext will use this index to execute the specified fulltext query.
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Working with Geo Indexes
|
||||
Working with Geo Indexes
|
||||
========================
|
||||
|
||||
<!-- js/actions/api-index.js -->
|
||||
@startDocuBlock JSF_post_api_index_geo
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
!CHAPTER Working with Hash Indexes
|
||||
Working with Hash Indexes
|
||||
=========================
|
||||
|
||||
If a suitable hash index exists, then */_api/simple/by-example* will use this index to execute a query-by-example.
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue