mirror of https://gitee.com/bigwinds/arangodb
updated manual
This commit is contained in:
parent
15d5037827
commit
f78541caea
|
@ -19,6 +19,8 @@ The following comparison operators are supported:
|
|||
- *IN* test if a value is contained in an array
|
||||
- *NOT IN* test if a value is not contained in an array
|
||||
- *LIKE* tests if a string value matches a pattern
|
||||
- *=~* tests if a string value matches a regular expression
|
||||
- *!~* tests if a string value does not match a regular expression
|
||||
|
||||
Each of the comparison operators returns a boolean value if the comparison can
|
||||
be evaluated and returns *true* if the comparison evaluates to true, and *false*
|
||||
|
@ -46,6 +48,8 @@ true != null // true
|
|||
"abc" == "abc" // true
|
||||
"abc" == "ABC" // false
|
||||
"foo" LIKE "f%" // true
|
||||
"foo" =~ "^f[o].$" // true
|
||||
"foo" !~ "[a-z]+bar$" // true
|
||||
```
|
||||
|
||||
The *LIKE* operator checks whether its left operand matches the pattern specified
|
||||
|
@ -64,6 +68,9 @@ or underscore.
|
|||
|
||||
The pattern matching performed by the *LIKE* operator is case-sensitive.
|
||||
|
||||
The regular expression operators *=~* and *!~* expect their left-hand operands to
|
||||
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.
|
||||
|
||||
!SUBSUBSECTION Array comparison operators
|
||||
|
||||
|
@ -135,14 +142,8 @@ Some examples for logical operations in AQL:
|
|||
! u.isInvalid
|
||||
1 || ! 0
|
||||
|
||||
Older versions of ArangoDB required the operands of all logical operators to
|
||||
be boolean values and failed when non-boolean values were passed into the
|
||||
operators. Additionally, the result of any logical operation always was a
|
||||
boolean value.
|
||||
|
||||
This behavior has changed in ArangoDB 2.3. Passing non-boolean values to a
|
||||
logical operator is now allowed. Any-non boolean operands will be casted
|
||||
to boolean implicitly by the operator, without making the query abort.
|
||||
Passing non-boolean values to a logical operator is allowed. Any-non boolean operands
|
||||
will be casted to boolean implicitly by the operator, without making the query abort.
|
||||
|
||||
The *conversion to a boolean value* works as follows:
|
||||
- `null` will be converted to `false`
|
||||
|
@ -223,7 +224,7 @@ applied by the [TO_NUMBER()](Functions/TypeCast.md#tonumber) function:
|
|||
- objects / documents are converted to the number `0`.
|
||||
|
||||
An arithmetic operation that produces an invalid value, such as `1 / 0` (division by zero)
|
||||
will also produce a result value of `0`.
|
||||
will also produce a result value of `null`.
|
||||
|
||||
Here are a few examples:
|
||||
|
||||
|
|
|
@ -75,6 +75,55 @@ Examples:
|
|||
["foo", "bar"] ANY == "foo" // true
|
||||
```
|
||||
|
||||
!SUBSUBSECTION Regular expression string-comparison operators
|
||||
|
||||
AQL now supports the operators *=~* and *!~* for testing strings against regular
|
||||
expressions. *=~* tests if a string value matches a regular expression, and *!~* tests
|
||||
if a string value does not match a regular expression.
|
||||
|
||||
The two operators expect their left-hand operands to be strings, and their right-hand
|
||||
operands to be strings containing valid regular expressions as specified below.
|
||||
|
||||
The regular expressions may consist of literal characters and the following
|
||||
characters and sequences:
|
||||
|
||||
- `.` – the dot matches any single character except line terminators.
|
||||
To include line terminators, use `[\s\S]` instead to simulate `.` with *DOTALL* flag.
|
||||
- `\d` – matches a single digit, equivalent to `[0-9]`
|
||||
- `\s` – matches a single whitespace character
|
||||
- `\S` – matches a single non-whitespace character
|
||||
- `\t` – matches a tab character
|
||||
- `\r` – matches a carriage return
|
||||
- `\n` – matches a line-feed character
|
||||
- `[xyz]` – set of characters. matches any of the enclosed characters (i.e.
|
||||
*x*, *y* or *z* in this case
|
||||
- `[^xyz]` – negated set of characters. matches any other character than the
|
||||
enclosed ones (i.e. anything but *x*, *y* or *z* in this case)
|
||||
- `[x-z]` – range of characters. Matches any of the characters in the
|
||||
specified range, e.g. `[0-9A-F]` to match any character in
|
||||
*0123456789ABCDEF*
|
||||
- `[^x-z]` – negated range of characters. Matches any other character than the
|
||||
ones specified in the range
|
||||
- `(xyz)` – defines and matches a pattern group
|
||||
- `(x|y)` – matches either *x* or *y*
|
||||
- `^` – matches the beginning of the string (e.g. `^xyz`)
|
||||
- `$` – matches the end of the string (e.g. `xyz$`)
|
||||
|
||||
Note that the characters `.`, `*`, `?`, `[`, `]`, `(`, `)`, `{`, `}`, `^`,
|
||||
and `$` have a special meaning in regular expressions and may need to be
|
||||
escaped using a backslash (`\\`). A literal backslash should also be escaped
|
||||
using another backslash, i.e. `\\\\`.
|
||||
|
||||
Characters and sequences may optionally be repeated using the following
|
||||
quantifiers:
|
||||
|
||||
- `x*` – matches zero or more occurrences of *x*
|
||||
- `x+` – matches one or more occurrences of *x*
|
||||
- `x?` – matches one or zero occurrences of *x*
|
||||
- `x{y}` – matches exactly *y* occurrences of *x*
|
||||
- `x{y,z}` – matches between *y* and *z* occurrences of *x*
|
||||
- `x{y,}` – matches at least *y* occurences of *x*
|
||||
|
||||
!SUBSUBSECTION Enclosing identifiers in forward ticks
|
||||
|
||||
AQL identifiers can now optionally be enclosed in forward ticks in addition to using
|
||||
|
@ -92,45 +141,8 @@ The following AQL functions have been added in 3.0:
|
|||
- *REGEX_TEST(value, regex)*: tests whether the string *value* matches the regular expression
|
||||
specified in *regex*. Returns *true* if it matches, and *false* otherwise.
|
||||
|
||||
The regular expression may consist of literal characters and the following
|
||||
characters and sequences:
|
||||
|
||||
- `.` – the dot matches any single character except line terminators.
|
||||
To include line terminators, use `[\s\S]` instead to simulate `.` with *DOTALL* flag.
|
||||
- `\d` – matches a single digit, equivalent to `[0-9]`
|
||||
- `\s` – matches a single whitespace character
|
||||
- `\S` – matches a single non-whitespace character
|
||||
- `\t` – matches a tab character
|
||||
- `\r` – matches a carriage return
|
||||
- `\n` – matches a line-feed character
|
||||
- `[xyz]` – set of characters. matches any of the enclosed characters (i.e.
|
||||
*x*, *y* or *z* in this case
|
||||
- `[^xyz]` – negated set of characters. matches any other character than the
|
||||
enclosed ones (i.e. anything but *x*, *y* or *z* in this case)
|
||||
- `[x-z]` – range of characters. Matches any of the characters in the
|
||||
specified range, e.g. `[0-9A-F]` to match any character in
|
||||
*0123456789ABCDEF*
|
||||
- `[^x-z]` – negated range of characters. Matches any other character than the
|
||||
ones specified in the range
|
||||
- `(xyz)` – defines and matches a pattern group
|
||||
- `(x|y)` – matches either *x* or *y*
|
||||
- `^` – matches the beginning of the string (e.g. `^xyz`)
|
||||
- `$` – matches the end of the string (e.g. `xyz$`)
|
||||
|
||||
Note that the characters `.`, `*`, `?`, `[`, `]`, `(`, `)`, `{`, `}`, `^`,
|
||||
and `$` have a special meaning in regular expressions and may need to be
|
||||
escaped using a backslash (`\\`). A literal backslash should also be escaped
|
||||
using another backslash, i.e. `\\\\`.
|
||||
|
||||
Characters and sequences may optionally be repeated using the following
|
||||
quantifiers:
|
||||
|
||||
- `x*` – matches zero or more occurrences of *x*
|
||||
- `x+` – matches one or more occurrences of *x*
|
||||
- `x?` – matches one or zero occurrences of *x*
|
||||
- `x{y}` – matches exactly *y* occurrences of *x*
|
||||
- `x{y,z}` – matches between *y* and *z* occurrences of *x*
|
||||
- `x{y,}` – matches at least *y* occurences of *x*
|
||||
The syntax for regular expressions is the same as for the regular expression operators
|
||||
*=~* and *!~*.
|
||||
|
||||
- *HASH(value)*: Calculates a hash value for *value*. *value* is not required to be a
|
||||
string, but can have any data type. The calculated hash value will take the data type
|
||||
|
|
|
@ -8,7 +8,7 @@ upgrading to ArangoDB 3.0, and adjust any client programs if necessary.
|
|||
Building ArangoDB 3.0 from source now requires CMake.
|
||||
|
||||
The pre-3.0 build system used a configure-based approach. The steps to build
|
||||
ArangoDB from source code in 2.8 were:
|
||||
ArangoDB 2.8 from source code were:
|
||||
|
||||
```
|
||||
make setup
|
||||
|
|
Loading…
Reference in New Issue