1
0
Fork 0

the great rename: array => object, list => array

This commit is contained in:
Jan Steemann 2014-12-18 22:33:23 +01:00
parent 20e7fe7a7a
commit d92057dd03
59 changed files with 1011 additions and 783 deletions

View File

@ -1,6 +1,19 @@
v2.4.0 (XXXX-XX-XX)
-------------------
* global internal rename to fix naming incompatibility with JSON:
Internal functions with names containing `array` have been renamed to `object`,
internal functions with names containing `list` have been renamed to `array`.
The renaming was mainly done in the C++ parts. The documentation has also been
adjusted so that the correct JSON type names are used in most places.
The change also led to the addition of a few function aliases in AQL:
* `TO_LIST` now is an alias of the new `TO_ARRAY`
* `IS_LIST` now is an alias of the new `IS_ARRAY`
* `IS_DOCUMENT` now is an alias of the new `IS_OBJECT`
* AQL: range optimizations for IN and OR
* fixed missing makeDirectory when fetching a Foxx application from a zip file

View File

@ -34,13 +34,13 @@ Subqueries may also include other subqueries themselves.
!SUBSECTION Variable expansion
In order to access a named attribute from all elements in a list easily, AQL
In order to access a named attribute from all elements in an array easily, AQL
offers the shortcut operator <i>[\*]</i> for variable expansion.
Using the <i>[\*]</i> operator with a variable will iterate over all elements in the
variable thus allowing to access a particular attribute of each element. It is
required that the expanded variable is a list. The result of the <i>[\*]</i>
operator is again a list.
required that the expanded variable is an array. The result of the <i>[\*]</i>
operator is again an array.
```js
FOR u IN users
@ -48,5 +48,5 @@ FOR u IN users
```
In the above example, the attribute *name* is accessed for each element in the
list *u.friends*. The result is a flat list of friend names, made available as
array *u.friends*. The result is a flat array of friend names, made available as
the attribute *friendNames*.

View File

@ -0,0 +1,257 @@
!CHAPTER Array functions
AQL supports the following functions to operate on array values:
- *LENGTH(array)*: Returns the length (number of array elements) of *array*. If
*array* is an object / document, returns the number of attribute keys of the document,
regardless of their values.
- *FLATTEN(array, depth)*: Turns an array of arrays into a flat array. All
array elements in *array* will be expanded in the result array. Non-array elements
are added as they are. The function will recurse into sub-arrays up to a depth of
*depth*. *depth* has a default value of 1.
*Examples*
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ])
will produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, [ 9, 10 ] ]
To fully flatten the array, use a *depth* of 2:
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ], 2)
This will produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
- *MIN(array)*: Returns the smallest element of *array*. *null* values
are ignored. If the array is empty or only *null* values are contained in the array, the
function will return *null*.
- *MAX(array)*: Returns the greatest element of *array*. *null* values
are ignored. If the array is empty or only *null* values are contained in the array, the
function will return *null*.
- *AVERAGE(array)*: Returns the average (arithmetic mean) of the values in *array*.
This requires the elements in *array* to be numbers. *null* values are ignored.
If the array is empty or only *null* values are contained in the array, the function
will return *null*.
- *SUM(array)*: Returns the sum of the values in *array*. This
requires the elements in *array* to be numbers. *null* values are ignored.
- *MEDIAN(array)*: Returns the median value of the values in *array*. This
requires the elements in *array* to be numbers. *null* values are ignored. If the
array is empty or only *null* values are contained in the array, the function will return
*null*.
- *PERCENTILE(array, n, method)*: Returns the *n*th percentile of the values in *array*.
This requires the elements in *array* to be numbers. *null* values are ignored. *n* must
be between 0 (excluded) and 100 (included). *method* can be *rank* or *interpolation*.
The function will return null if the array is empty or only *null* values are contained
in it or the percentile cannot be calculated.
- *VARIANCE_POPULATION(array)*: Returns the population variance of the values in
*array*. This requires the elements in *array* to be numbers. *null* values
are ignored. If the array is empty or only *null* values are contained in the array,
the function will return *null*.
- *VARIANCE_SAMPLE(array)*: Returns the sample variance of the values in
*array*. This requires the elements in *array* to be numbers. *null* values
are ignored. If the array is empty or only *null* values are contained in the array,
the function will return *null*.
- *STDDEV_POPULATION(array)*: Returns the population standard deviation of the
values in *array*. This requires the elements in *array* to be numbers. *null*
values are ignored. If the array is empty or only *null* values are contained in the array,
the function will return *null*.
- *STDDEV_SAMPLE(array)*: Returns the sample standard deviation of the values in
*array*. This requires the elements in *array* to be numbers. *null* values
are ignored. If the array is empty or only *null* values are contained in the array,
the function will return *null*.
- *REVERSE(array)*: Returns the elements in *array* in reversed order.
- *FIRST(array)*: Returns the first element in *array* or *null* if the
array is empty.
- *LAST(array)*: Returns the last element in *array* or *null* if the
array is empty.
- *NTH(array, position)*: Returns the array element at position *position*.
Positions start at 0. If *position* is negative or beyond the upper bound of the array
specified by *array*, then *null* will be returned.
- *POSITION(array, search, return-index)*: Returns the position of the
element *search* in *array*. Positions start at 0. If the element is not
found, then *-1* is returned. If *return-index* is *false*, then instead of the
position only *true* or *false* are returned, depending on whether the sought element
is contained in the array.
- *SLICE(array, start, length)*: Extracts a slice of the array specified
by *array*. The extraction will start at array element with position *start*.
Positions start at 0. Up to *length* elements will be extracted. If *length* is
not specified, all array elements starting at *start* will be returned.
If *start* is negative, it can be used to indicate positions from the end of the
array.
*Examples*
SLICE([ 1, 2, 3, 4, 5 ], 0, 1)
will return *[ 1 ]*
SLICE([ 1, 2, 3, 4, 5 ], 1, 2)
will return *[ 2, 3 ]*
SLICE([ 1, 2, 3, 4, 5 ], 3)
will return *[ 4, 5 ]*
SLICE([ 1, 2, 3, 4, 5 ], 1, -1)
will return *[ 2, 3, 4 ]*
SLICE([ 1, 2, 3, 4, 5 ], 0, -2)
will return *[ 1, 2, 3 ]*
- *UNIQUE(array)*: Returns all unique elements in *array*. To determine
uniqueness, the function will use the comparison order.
Calling this function may return the unique elements in any order.
- *UNION(array1, array2, ...)*: Returns the union of all arrays specified.
The function expects at least two array values as its arguments. The result is an array
of values in an undefined order.
Note: No duplicates will be removed. In order to remove duplicates, please use either
*UNION_DISTINCT* function or apply the *UNIQUE* on the result of *union*.
*Examples*
RETURN UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
will produce:
[ [ 1, 2, 3, 1, 2 ] ]
with duplicate removal:
RETURN UNIQUE(
UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
)
will produce:
[ [ 1, 2, 3 ] ]
- *UNION_DISTINCT(array1, array2, ...)*: Returns the union of distinct values of
all arrays specified. The function expects at least two array values as its arguments.
The result is an array of values in an undefined order.
- *MINUS(array1, array2, ...)*: Returns the difference of all arrays specified.
The function expects at least two array values as its arguments.
The result is an array of values that occur in the first array but not in any of the
subsequent arrays. The order of the result array is undefined and should not be relied on.
Note: duplicates will be removed.
- *INTERSECTION(array1, array2, ...)*: Returns the intersection of all arrays specified.
The function expects at least two array values as its arguments.
The result is an array of values that occur in all arguments. The order of the result array
is undefined and should not be relied on.
Note: Duplicates will be removed.
- *APPEND(array, values, unique)*: Adds all elements from the array *values* to the array
specified by *array*. If *unique* is set to true, then only those *values* will be added
that are not already contained in *array*.
The modified array is returned. All values are added at the end of the array (right side).
/* [ 1, 2, 3, 5, 6, 9 ] */
APPEND([ 1, 2, 3 ], [ 5, 6, 9 ])
/* [ 1, 2, 3, 4, 5, 9 ] */
APPEND([ 1, 2, 3 ], [ 3, 4, 5, 2, 9 ], true)
- *PUSH(array, value, unique)*: Adds *value* to the array specified by *array*. If
*unique* is set to true, then *value* is not added if already present in the array.
The modified array is returned. The value is added at the end of the array (right side).
Note: non-unique elements will not be removed from the array if they were already present
before the call to `PUSH`. The *unique* flag will only control if the value will
be added again to the array if already present. To make a array unique, use the `UNIQUE`
function.
/* [ 1, 2, 3, 4 ] */
PUSH([ 1, 2, 3 ], 4)
/* [ 1, 2, 3 ] */
PUSH([ 1, 2, 3 ], 2, true)
- *UNSHIFT(array, value, unique)*: Adds *value* to the array specified by *array*. If
*unique* is set to true, then *value* is not added if already present in the array.
The modified array is returned. The value is added at the start of the array (left side).
Note: non-unique elements will not be removed from the array if they were already present
before the call to `UNSHIFT`. The *unique* flag will only control if the value will
be added again to the array if already present. To make a array unique, use the `UNIQUE`
function.
/* [ 4, 1, 2, 3 ] */
UNSHIFT([ 1, 2, 3 ], 4)
/* [ 1, 2, 3 ] */
UNSHIFT([ 1, 2, 3 ], 2, true)
- *POP(array)*: Removes the element at the end (right side) of *array*. The modified array
is returned. If the array is already empty or *null*, an empty array is returned.
/* [ 1, 2, 3 ] */
POP([ 1, 2, 3, 4 ])
- *SHIFT(array)*: Removes the element at the start (left side) of *array*. The modified array
is returned. If the array is already empty or *null*, an empty array is returned.
/* [ 2, 3, 4 ] */
SHIFT([ 1, 2, 3, 4 ])
- *REMOVE_VALUE(array, value, limit)*: Removes all occurrences of *value* in the array
specified by *array*. If the optional *limit* is specified, only *limit* occurrences
will be removed.
/* [ "b", "b", "c" ] */
REMOVE_VALUE([ "a", "b", "b", "a", "c" ], "a")
/* [ "b", "b", "a", "c" ] */
REMOVE_VALUE([ "a", "b", "b", "a", "c" ], "a", 1)
- *REMOVE_VALUES(array, values)*: Removes all occurrences of any of the values specified
in array *values* from the array specified by *array*.
/* [ "b", "c", "e", "g" ] */
REMOVE_VALUES([ "a", "b", "c", "d", "e", "f", "g" ], [ "a", "f", "d" ])
- *REMOVE_NTH(array, position)*: Removes the element at position *position* from the
array specified by *array*. Positions start at 0. Negative positions are supported,
with -1 being the last array element. If *position* is out of bounds, the array is
returned unmodified. Otherwise, the modified array is returned.
/* [ "a", "c", "d", "e" ] */
REMOVE_NTH([ "a", "b", "c", "d", "e" ], 1)
/* [ "a", "b", "c", "e" ] */
REMOVE_NTH([ "a", "b", "c", "d", "e" ], -2)
Apart from these functions, AQL also offers several language constructs (e.g.
*FOR*, *SORT*, *LIMIT*, *COLLECT*) to operate on arrays.

View File

@ -46,7 +46,7 @@ AQL supports two types of comments:
!SUBSECTION Keywords
On the top level, AQL offers the following operations:
- `FOR`: list iteration
- `FOR`: array iteration
- `RETURN`: results projection
- `FILTER`: results filtering
- `SORT`: result sorting
@ -189,8 +189,8 @@ available:
- number: Signed (real) number
- string: UTF-8 encoded text value
- Compound types: Consisting of multiple values
- list: Sequence of values, referred to by their positions
- document: Sequence of values, referred to by their names
- array: Sequence of values, referred to by their positions
- object / document: Sequence of values, referred to by their names
!SUBSUBSECTION Numeric literals
@ -232,65 +232,65 @@ 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.
!SUBSUBSECTION Lists
!SUBSUBSECTION Arrays
AQL supports two compound types:
- lists: A composition of unnamed values, each accessible by their positions
- documents: A composition of named values, each accessible by their names
- arrays: A composition of unnamed values, each accessible by their positions
- objects / documents: A composition of named values, each accessible by their names
The first supported compound type is the list type. Lists are effectively
sequences of (unnamed/anonymous) values. Individual list elements can be
accessed by their positions. The order of elements in a list is important.
The first supported compound type is the array type. Arrays are effectively
sequences of (unnamed / anonymous) values. Individual array elements can be
accessed by their positions. The order of elements in an array is important.
A *list-declaration* starts with the *[* symbol and ends with the *]* symbol. A
*list-declaration* contains zero or many *expression*s, separated from each
An *array-declaration* starts with the *[* symbol and ends with the *]* symbol. An
*array-declaration* contains zero or many *expression*s, separated from each
other with the *,* symbol.
In the easiest case, a list is empty and thus looks like:
In the easiest case, an array is empty and thus looks like:
[ ]
List elements can be any legal *expression* values. Nesting of lists is
Array elements can be any legal *expression* values. Nesting of arrays is
supported.
[ 1, 2, 3 ]
[ -99, "yikes!", [ true, [ "no"], [ ] ], 1 ]
[ [ "fox", "marshal" ] ]
Individual list values can later be accesses by their positions using the *[]*
Individual array values can later be accesses bd their positions using the *[]*
accessor. The position of the accessed element must be a numeric
value. Positions start at 0. It is also possible to use negative index values
to access list values starting from the end of the list. This is convenient if
the length of the list is unknown and access to elements at the end of the list
to access array values starting from the end of the array. This is convenient if
the length of the array is unknown and access to elements at the end of the array
is required.
// access 1st list element (element start at index 0)
// access 1st array element (element start at index 0)
u.friends[0]
// access 3rd list element
// access 3rd array element
u.friends[2]
// access last list element
// access last array element
u.friends[-1]
// access second last list element
// access second last array element
u.friends[-2]
!SUBSUBSECTION Documents
!SUBSUBSECTION Objects / Documents
The other supported compound type is the document type. Documents are a
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.
Document attributes can be accessed individually by their names.
Object attributes can be accessed individually by their names.
Document declarations start with the *{* symbol and end with the *}* symbol. A
document contains zero to many attribute declarations, separated from each other
with the *,* symbol. In the simplest case, a document is empty. Its
Object declarations start with the *{* symbol and end with the *}* symbol. An
object contains zero to many attribute declarations, separated from each other
with the *,* symbol. In the simplest case, an object is empty. Its
declaration would then be:
{ }
Each attribute in a document is a name/value pair. Name and value of an
Each attribute in an object is a name / value pair. Name and value of an
attribute are separated using the *:* symbol.
The attribute name is mandatory and must be specified as a quoted or unquoted
@ -298,13 +298,13 @@ string. If a keyword is to be used as an attribute name, the name must be
quoted.
Any valid expression can be used as an attribute value. That also means nested
documents can be used as attribute values
objects can be used as attribute values:
{ name : "Peter" }
{ "name" : "Vanessa", "age" : 15 }
{ "name" : "John", likes : [ "Swimming", "Skiing" ], "address" : { "street" : "Cucumber lane", "zip" : "94242" } }
Individual document attributes can later be accesses by their names using the
Individual object attributes can later be accessed by their names using the
*.* accessor. If a non-existing attribute is accessed, the result is *null*.
u.address.city.name
@ -353,14 +353,14 @@ data values if the operands have the same data types.
The following type order is used when comparing data types:
null < bool < number < string < list < document
null < bool < number < string < array < object / document
This means *null* is the smallest type in AQL and *document* is the type with
the highest order. If the compared operands have a different type, then the
comparison result is determined and the comparison is finished.
For example, the boolean *true* value will always be less than any numeric or
string value, any list (even an empty list) or any document. Additionally, any
string value, any array (even an empty array) or any object / document. Additionally, any
string value (even an empty string) will always be greater than any numeric
value, a boolean value, *true* or *false*.
@ -420,17 +420,17 @@ itself, without the result being converted into *null* automatically.
For compound, types the following special rules are applied:
Two list values are compared by comparing their individual elements position by
Two array values are compared by comparing their individual elements position by
position, starting at the first element. For each position, the element types
are compared first. If the types are not equal, the comparison result is
determined, and the comparison is finished. If the types are equal, then the
values of the two elements are compared. If one of the lists is finished and
the other list still has an element at a compared position, then *null* will be
used as the element value of the fully traversed list.
values of the two elements are compared. If one of the arrays is finished and
the other array still has an element at a compared position, then *null* will be
used as the element value of the fully traversed array.
If a list element is itself a compound value (a list or a document), then the
If an array element is itself a compound value (an array or an object / document), then the
comparison algorithm will check the element's sub values recursively. The element's
sub elements are compared recursively.
sub-elements are compared recursively.
[ ] < [ 0 ]
[ 1 ] < [ 2 ]
@ -439,21 +439,21 @@ sub elements are compared recursively.
[ false ] < [ true ]
[ false, 1 ] < [ false, '' ]
Two documents operands are compared by checking attribute names and value. The
Two object / documents operands are compared by checking attribute names and value. The
attribute names are compared first. Before attribute names are compared, a
combined list of all attribute names from both operands is created and sorted
combined array of all attribute names from both operands is created and sorted
lexicographically. This means that the order in which attributes are declared
in a document is not relevant when comparing two documents.
in an object / document is not relevant when comparing two objects / documents.
The combined and sorted list of attribute names is then traversed, and the
The combined and sorted array of attribute names is then traversed, and the
respective attributes from the two compared operands are then looked up. If one
of the documents does not have an attribute with the sought name, its attribute
of the objects / documents does not have an attribute with the sought name, its attribute
value is considered to be *null*. Finally, the attribute value of both
documents is compared using the before mentioned data type and value comparison.
The comparisons are performed for all document attributes until there is an
objects / documents is compared using the before mentioned data type and value comparison.
The comparisons are performed for all object / document attributes until there is an
unambiguous comparison result. If an unambiguous comparison result is found, the
comparison is finished. If there is no unambiguous comparison result, the two
compared documents are considered equal.
compared objects / documents are considered equal.
{ } < { "a" : 1 }
{ } < { "a" : null }
@ -467,7 +467,7 @@ compared documents are considered equal.
!SUBSECTION Accessing data from collections
Collection data can be accessed by specifying a collection name in a query. A
collection can be understood as a list of documents, and that is how they are
collection can be understood as an array of documents, and that is how they are
treated in AQL. Documents from collections are normally accessing using the
*FOR* keyword. Note that when iterating over documents from a collection, the
order of documents is undefined. To traverse documents in an explicit and

View File

@ -3,7 +3,7 @@
AQL supports the following functions to operate on document values:
- *MATCHES(document, examples, return-index)*: Compares the document
*document* against each example document provided in the list *examples*.
*document* against each example document provided in the array *examples*.
If *document* matches one of the examples, *true* is returned, and if there is
no match *false* will be returned. The default return value type can be changed by
passing *true* as the third function parameter *return-index*. Setting this
@ -15,8 +15,8 @@ AQL supports the following functions to operate on document values:
comparison stops and the result is returned. If there is a mismatch, the function will
continue the comparison with the next example until there are no more examples left.
The *examples* must be a list of 1..n example documents, with any number of attributes
each. Note: specifying an empty list of examples is not allowed.
The *examples* must be an array of 1..n example documents, with any number of attributes
each. Note: specifying an empty array of examples is not allowed.
@EXAMPLES
@ -85,18 +85,18 @@ AQL supports the following functions to operate on document values:
attribute named *attributename*, and *false* otherwise.
- *ATTRIBUTES(document, removeInternal, sort)*: Returns the attribute
names of the *document* as a list.
names of the *document* as an array.
If *removeInternal* is set to *true*, then all internal attributes (such as *_id*,
*_key* etc.) are removed from the result. If *sort* is set to *true*, then the
attribute names in the result will be sorted. Otherwise they will be returned in any order.
- *VALUES(document, removeInternal)*: Returns the attribute values of the *document*
as a list. If *removeInternal* is set to *true*, then all internal attributes (such
as an array. If *removeInternal* is set to *true*, then all internal attributes (such
as *_id*, *_key* etc.) are removed from the result.
- *ZIP(attributes, values)*: Returns a document object assembled from the
separate parameters *attributes* and *values*. *attributes* and *values* must be
lists and must have the same length. The items in *attributes* will be used for
arrays and must have the same length. The items in *attributes* will be used for
naming the attributes in the result. The items in *values* will be used as the
actual values of the result.
@ -106,7 +106,7 @@ AQL supports the following functions to operate on document values:
- *UNSET(document, attributename, ...)*: Removes the attributes *attributename*
(can be one or many) from *document*. All other attributes will be preserved.
Multiple attribute names can be specified by either passing multiple individual string argument
names, or by passing a list of attribute names:
names, or by passing an array of attribute names:
UNSET(doc, '_id', '_key', [ 'foo', 'bar' ])
UNSET(doc, [ '_id', '_key', 'foo', 'bar' ])
@ -114,7 +114,7 @@ AQL supports the following functions to operate on document values:
- *KEEP(document, attributename, ...)*: Keeps only the attributes *attributename*
(can be one or many) from *document*. All other attributes will be removed from the result.
Multiple attribute names can be specified by either passing multiple individual string argument
names, or by passing a list of attribute names:
names, or by passing an array of attribute names:
KEEP(doc, 'firstname', 'name', 'likes')
KEEP(doc, [ 'firstname', 'name', 'likes' ])

View File

@ -36,10 +36,10 @@ with an error.
*polygon* parameter. The result is undefined (may be `true` or `false`) if the specified point
is exactly on a boundary of the polygon.
*latitude* can alternatively be specified as a list with two values. By default,
the first list element will be interpreted as the latitude value and the second list element
*latitude* can alternatively be specified as an array with two values. By default,
the first array element will be interpreted as the latitude value and the second array element
as the longitude value. This can be changed by setting the 3rd parameter to `true`.
*polygon* needs to be a list of points, with each point being a list with two values. The
*polygon* needs to be an array of points, with each point being an array with two values. The
first value of each point is considered to be the latitude value and the second to be the
longitude value, unless the 3rd parameter has a value of `true`. That means latitude and
longitude need to be specified in the same order in the *points* parameter as they are in

View File

@ -6,7 +6,7 @@ If you have created a graph in the general-graph module you may want to use
[Graph operations](../Aql/GraphOperations.md) instead.
- *PATHS(vertexcollection, edgecollection, direction, followcycles)*:
returns a list of paths through the graph defined by the nodes in the collection
returns an array of paths through the graph defined by the nodes in the collection
*vertexcollection* and edges in the collection *edgecollection*. For each vertex
in *vertexcollection*, it will determine the paths through the graph depending on the
value of *direction*:
@ -17,10 +17,10 @@ If you have created a graph in the general-graph module you may want to use
If *followcycles* is true, cyclic paths will be followed as well. This is turned off by
default.
The result of the function is a list of paths. Paths of length 0 will also be returned. Each
The result of the function is an array of paths. Paths of length 0 will also be returned. Each
path is a document consisting of the following attributes:
- *vertices*: list of vertices visited along the path
- *edges*: list of edges visited along the path (may be empty)
- *vertices*: array of vertices visited along the path
- *edges*: array of edges visited along the path (may be empty)
- *source*: start vertex of path
- *destination*: destination vertex of path
@ -63,7 +63,7 @@ If you have created a graph in the general-graph module you may want to use
for big graphs to limit the traversal to some sensible amount, and for graphs
containing cycles to prevent infinite traversals. The maximum depth defaults to 256,
with the chance of this value being non-sensical. For several graphs, a much lower
maximum depth is sensible, whereas for other, more list-oriented graphs a higher
maximum depth is sensible, whereas for other, more array-oriented graphs a higher
depth should be used
- *paths*: If *true*, the paths encountered during the traversal will
also be returned along with each traversed vertex. If *false*, only the
@ -79,7 +79,7 @@ If you have created a graph in the general-graph module you may want to use
- *global*: An edge may be visited at most once. This is the default
- *path*: An edge is visited only if not already contained in the current
traversal path
- *followEdges*: An optional list of example edge documents that the traversal will
- *followEdges*: An optional array of example edge documents that the traversal will
expand into. If no examples are given, the traversal will follow all edges. If one
or many edge examples are given, the traversal will only follow an edge if it matches
at least one of the specified examples. *followEdges* can also be a string with the
@ -92,7 +92,7 @@ If you have created a graph in the general-graph module you may want to use
The function is expected to return a boolean value. If it returns *true*, the edge
will be followed. If *false* is returned, the edge will be ignored.
- *filterVertices*: An optional list of example vertex documents that the traversal will
- *filterVertices*: An optional array of example vertex documents that the traversal will
treat specially. If no examples are given, the traversal will handle all encountered
vertices equally. If one or many vertex examples are given, the traversal will exclude
any non-matching vertex from the result and/or not descend into it. Optionally,
@ -114,11 +114,11 @@ If you have created a graph in the general-graph module you may want to use
- *[ "exclude" ]*: Will not include non-matching vertices in the result but descend into them
- *[ "prune", "exclude" ]*: Will neither include non-matching vertices in the result nor descend into them
The result of the TRAVERSAL function is a list of traversed points. Each point is a
The result of the TRAVERSAL function is a array of traversed points. Each point is a
document consisting of the following attributes:
- *vertex*: The vertex at the traversal point
- *path*: The path history for the traversal point. The path is a document with the
attributes *vertices* and *edges*, which are both lists. Note that *path* is only present
attributes *vertices* and *edges*, which are both arrays. Note that *path* is only present
in the result if the *paths* attribute is set in the *options*
*Examples*
@ -179,8 +179,8 @@ If you have created a graph in the general-graph module you may want to use
Traverses the graph described by *vertexcollection* and *edgecollection*,
starting at the vertex identified by id *startVertex* and creates a hierarchical result.
Vertex connectivity is establish by inserted an attribute which has the name specified via
the *connectName* parameter. Connected vertices will be placed in this attribute as a
list.
the *connectName* parameter. Connected vertices will be placed in this attribute as an
array.
The *options* are the same as for the *TRAVERSAL* function, except that the result will
be set up in a way that resembles a depth-first, pre-order visitation result. Thus, the
@ -236,7 +236,7 @@ If you have created a graph in the general-graph module you may want to use
same distance (1) to each other. If a function name is specified, it must have been
registered as a regular user-defined AQL function.
- *followEdges*: An optional list of example edge documents that the search will
- *followEdges*: An optional array of example edge documents that the search will
expand into. If no examples are given, the search will follow all edges. If one
or many edge examples are given, the search will only follow an edge if it matches
at least one of the specified examples. *followEdges* can also be a string with the
@ -249,7 +249,7 @@ If you have created a graph in the general-graph module you may want to use
The function is expected to return a boolean value. If it returns *true*, the edge
will be followed. If *false* is returned, the edge will be ignored.
- *filterVertices*: An optional list of example vertex documents that the search will
- *filterVertices*: An optional array of example vertex documents that the search will
treat specially. If no examples are given, the search will handle all encountered
vertices equally. If one or many vertex examples are given, the search will exclude
the vertex from the result and/or not descend into it. Optionally, *filterVertices* can
@ -264,11 +264,11 @@ If you have created a graph in the general-graph module you may want to use
- *[ "exclude" ]*: Will not include the vertex in the result but descend into its connected edges
- *[ "prune", "exclude" ]*: Will completely ignore the vertex and its connected edges
The result of the SHORTEST_PATH function is a list with the components of the shortest
The result of the SHORTEST_PATH function is an array with the components of the shortest
path. Each component is a document consisting of the following attributes:
- *vertex*: The vertex at the traversal point
- *path*: The path history for the traversal point. The path is a document with the
attributes *vertices* and *edges*, which are both lists. Note that *path* is only present
attributes *vertices* and *edges*, which are both arrays. Note that *path* is only present
in the result if the *paths* attribute is set in the *options*.
*Examples*
@ -304,7 +304,7 @@ If you have created a graph in the general-graph module you may want to use
}, false);
- *EDGES(edgecollection, startvertex, direction, edgeexamples)*:
Return all edges connected to the vertex *startvertex* as a list. The possible values for
Return all edges connected to the vertex *startvertex* as an array. The possible values for
*direction* are:
- *outbound*: Return all outbound edges
- *inbound*: Return all inbound edges
@ -325,7 +325,7 @@ If you have created a graph in the general-graph module you may want to use
[Graph operations](../Aql/GraphOperations.md) instead.
- *NEIGHBORS(vertexcollection, edgecollection, startvertex, direction, edgeexamples)*:
Return all neighbors that are directly connected to the vertex *startvertex* as a list.
Return all neighbors that are directly connected to the vertex *startvertex* as an array.
The possible values for *direction* are:
- *outbound*: Return all outbound edges
- *inbound*: Return all inbound edges

View File

@ -21,7 +21,7 @@ To pass bind parameters into a query, they can be specified as second argument t
}).toArray();
Data-modifying AQL queries do not return a result, so the *toArray* method will always
return an empty list. To retrieve statistics for a data-modification query, use the
return an empty array. To retrieve statistics for a data-modification query, use the
*getExtra* method:
arangosh> db._query("FOR i IN 1..100 INSERT { _key: CONCAT('test', TO_STRING(i)) } INTO mycollection").getExtra();
@ -188,17 +188,17 @@ By default, the query optimizer will return what it considers to be the *optimal
optimal plan will be returned in the `plan` attribute of the result. If `explain` is
called with option `allPlans` set to `true`, all plans will be returned in the `plans`
attribute instead. The result object will also contain an attribute *warnings*, which
is a list of warnings that occurred during optimization or execution plan creation.
is an array of warnings that occurred during optimization or execution plan creation.
Each plan in the result is an object with the following attributes:
- *nodes*: the list of execution nodes of the plan. The list of available node types
- *nodes*: the array of execution nodes of the plan. The list of available node types
can be found [here](../Aql/Optimizer.html)
- *estimatedCost*: the total estimated cost for the plan. If there are multiple
plans, the optimizer will choose the plan with the lowest total cost.
- *collections*: a list of collections used in the query
- *rules*: a list of rules the optimizer applied. The list of rules can be
- *collections*: an array of collections used in the query
- *rules*: an array of rules the optimizer applied. The list of rules can be
found [here](../Aql/Optimizer.html)
- *variables*: list of variables used in the query (note: this may contain
- *variables*: array of variables used in the query (note: this may contain
internal variables created by the optimizer)
Here is an example for retrieving the execution plan of a simple query:
@ -333,7 +333,7 @@ arangosh> stmt.explain({ allPlans: true }).plans.map(function(plan) { return for
`explain` will also accept the following additional options:
- *maxPlans*: limits the maximum number of plans that are created by the AQL query optimizer
- *optimizer.rules*: a list of to-be-included or to-be-excluded optimizer rules
- *optimizer.rules*: an array of to-be-included or to-be-excluded optimizer rules
can be put into this attribute, telling the optimizer to include or exclude
specific rules. To disable a rule, prefix its name with a `-`, to enable a rule, prefix it
with a `+`. There is also a pseudo-rule `all`, which will match all optimizer rules.

View File

@ -1,257 +0,0 @@
!CHAPTER List functions
AQL supports the following functions to operate on list values:
- *LENGTH(list)*: Returns the length (number of list elements) of *list*. If
*list* is a document, returns the number of attribute keys of the document,
regardless of their values.
- *FLATTEN(list), depth)*: Turns a list of lists into a flat list. All
list elements in *list* will be expanded in the result list. Non-list elements
are added as they are. The function will recurse into sub-lists up to a depth of
*depth*. *depth* has a default value of 1.
*Examples*
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ])
will produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, [ 9, 10 ] ]
To fully flatten the list, use a *depth* of 2:
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ], 2)
This will produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
- *MIN(list)*: Returns the smallest element of *list*. *null* values
are ignored. If the list is empty or only *null* values are contained in the list, the
function will return *null*.
- *MAX(list)*: Returns the greatest element of *list*. *null* values
are ignored. If the list is empty or only *null* values are contained in the list, the
function will return *null*.
- *AVERAGE(list)*: Returns the average (arithmetic mean) of the values in *list*.
This requires the elements in *list* to be numbers. *null* values are ignored.
If the list is empty or only *null* values are contained in the list, the function
will return *null*.
- *SUM(list)*: Returns the sum of the values in *list*. This
requires the elements in *list* to be numbers. *null* values are ignored.
- *MEDIAN(list)*: Returns the median value of the values in *list*. This
requires the elements in *list* to be numbers. *null* values are ignored. If the
list is empty or only *null* values are contained in the list, the function will return
*null*.
- *PERCENTILE(list, n, method)*: Returns the *n*th percentile of the values in *list*.
This requires the elements in *list* to be numbers. *null* values are ignored. *n* must
be between 0 (excluded) and 100 (included). *method* can be *rank* or *interpolation*.
The function will return null if the list is empty or only *null* values are contained
in it or the percentile cannot be calculated.
- *VARIANCE_POPULATION(list)*: Returns the population variance of the values in
*list*. This requires the elements in *list* to be numbers. *null* values
are ignored. If the list is empty or only *null* values are contained in the list,
the function will return *null*.
- *VARIANCE_SAMPLE(list)*: Returns the sample variance of the values in
*list*. This requires the elements in *list* to be numbers. *null* values
are ignored. If the list is empty or only *null* values are contained in the list,
the function will return *null*.
- *STDDEV_POPULATION(list)*: Returns the population standard deviation of the
values in *list*. This requires the elements in *list* to be numbers. *null*
values are ignored. If the list is empty or only *null* values are contained in the list,
the function will return *null*.
- *STDDEV_SAMPLE(list)*: Returns the sample standard deviation of the values in
*list*. This requires the elements in *list* to be numbers. *null* values
are ignored. If the list is empty or only *null* values are contained in the list,
the function will return *null*.
- *REVERSE(list)*: Returns the elements in *list* in reversed order.
- *FIRST(list)*: Returns the first element in *list* or *null* if the
list is empty.
- *LAST(list)*: Returns the last element in *list* or *null* if the
list is empty.
- *NTH(list, position)*: Returns the list element at position *position*.
Positions start at 0. If *position* is negative or beyond the upper bound of the list
specified by *list*, then *null* will be returned.
- *POSITION(list, search, return-index)*: Returns the position of the
element *search* in list *list*. Positions start at 0. If the element is not
found, then *-1* is returned. If *return-index* is *false*, then instead of the
position only *true* or *false* are returned, depending on whether the sought element
is contained in the list.
- *SLICE(list, start, length)*: Extracts a slice of the list specified
by *list*. The extraction will start at list element with position *start*.
Positions start at 0. Up to *length* elements will be extracted. If *length* is
not specified, all list elements starting at *start* will be returned.
If *start* is negative, it can be used to indicate positions from the end of the
list.
*Examples*
SLICE([ 1, 2, 3, 4, 5 ], 0, 1)
will return *[ 1 ]*
SLICE([ 1, 2, 3, 4, 5 ], 1, 2)
will return *[ 2, 3 ]*
SLICE([ 1, 2, 3, 4, 5 ], 3)
will return *[ 4, 5 ]*
SLICE([ 1, 2, 3, 4, 5 ], 1, -1)
will return *[ 2, 3, 4 ]*
SLICE([ 1, 2, 3, 4, 5 ], 0, -2)
will return *[ 1, 2, 3 ]*
- *UNIQUE(list)*: Returns all unique elements in *list*. To determine
uniqueness, the function will use the comparison order.
Calling this function may return the unique elements in any order.
- *UNION(list1, list2, ...)*: Returns the union of all lists specified.
The function expects at least two list values as its arguments. The result is a list
of values in an undefined order.
Note: No duplicates will be removed. In order to remove duplicates, please use either
*UNION_DISTINCT* function or apply the *UNIQUE* on the result of *union*.
*Examples*
RETURN UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
will produce:
[ [ 1, 2, 3, 1, 2 ] ]
with duplicate removal:
RETURN UNIQUE(
UNION(
[ 1, 2, 3 ],
[ 1, 2 ]
)
)
will produce:
[ [ 1, 2, 3 ] ]
- *UNION_DISTINCT(list1, list2, ...)*: Returns the union of distinct values of
all lists specified. The function expects at least two list values as its arguments.
The result is a list of values in an undefined order.
- *MINUS(list1, list2, ...)*: Returns the difference of all lists specified.
The function expects at least two list values as its arguments.
The result is a list of values that occur in the first list but not in any of the
subsequent lists. The order of the result list is undefined and should not be relied on.
Note: duplicates will be removed.
- *INTERSECTION(list1, list2, ...)*: Returns the intersection of all lists specified.
The function expects at least two list values as its arguments.
The result is a list of values that occur in all arguments. The order of the result list
is undefined and should not be relied on.
Note: Duplicates will be removed.
- *APPEND(list, values, unique)*: Adds all elements from the list *values* to the list
specified by *list*. If *unique* is set to true, then only those *values* will be added
that are not already contained in *list*.
The modified list is returned. All values are added at the end of the list (right side).
/* [ 1, 2, 3, 5, 6, 9 ] */
APPEND([ 1, 2, 3 ], [ 5, 6, 9 ])
/* [ 1, 2, 3, 4, 5, 9 ] */
APPEND([ 1, 2, 3 ], [ 3, 4, 5, 2, 9 ], true)
- *PUSH(list, value, unique)*: Adds *value* to the list specified by *list*. If
*unique* is set to true, then *value* is not added if already present in the list.
The modified list is returned. The value is added at the end of the list (right side).
Note: non-unique elements will not be removed from the list if they were already present
before the call to `PUSH`. The *unique* flag will only control if the value will
be added again to the list if already present. To make a list unique, use the `UNIQUE`
function.
/* [ 1, 2, 3, 4 ] */
PUSH([ 1, 2, 3 ], 4)
/* [ 1, 2, 3 ] */
PUSH([ 1, 2, 3 ], 2, true)
- *UNSHIFT(list, value, unique)*: Adds *value* to the list specified by *list*. If
*unique* is set to true, then *value* is not added if already present in the list.
The modified list is returned. The value is added at the start of the list (left side).
Note: non-unique elements will not be removed from the list if they were already present
before the call to `UNSHIFT`. The *unique* flag will only control if the value will
be added again to the list if already present. To make a list unique, use the `UNIQUE`
function.
/* [ 4, 1, 2, 3 ] */
UNSHIFT([ 1, 2, 3 ], 4)
/* [ 1, 2, 3 ] */
UNSHIFT([ 1, 2, 3 ], 2, true)
- *POP(list)*: Removes the element at the end (right side) of *list*. The modified list
is returned. If the list is already empty or *null*, an empty list is returned.
/* [ 1, 2, 3 ] */
POP([ 1, 2, 3, 4 ])
- *SHIFT(list)*: Removes the element at the start (left side) of *list*. The modified list
is returned. If the list is already empty or *null*, an empty list is returned.
/* [ 2, 3, 4 ] */
SHIFT([ 1, 2, 3, 4 ])
- *REMOVE_VALUE(list, value, limit)*: Removes all occurrences of *value* in the list
specified by *list*. If the optional *limit* is specified, only *limit* occurrences
will be removed.
/* [ "b", "b", "c" ] */
REMOVE_VALUE([ "a", "b", "b", "a", "c" ], "a")
/* [ "b", "b", "a", "c" ] */
REMOVE_VALUE([ "a", "b", "b", "a", "c" ], "a", 1)
- *REMOVE_VALUES(list, values)*: Removes all occurrences of any of the values specified
in list *values* from the list specified by *list*.
/* [ "b", "c", "e", "g" ] */
REMOVE_VALUES([ "a", "b", "c", "d", "e", "f", "g" ], [ "a", "f", "d" ])
- *REMOVE_NTH(list, position)*: Removes the element at position *position* from the
list specified by *list*. Positions start at 0. Negative positions are supported,
with -1 being the last list element. If *position* is out of bounds, the list is
returned unmodified. Otherwise, the modified list is returned.
/* [ "a", "c", "d", "e" ] */
REMOVE_NTH([ "a", "b", "c", "d", "e" ], 1)
/* [ "a", "b", "c", "e" ] */
REMOVE_NTH([ "a", "b", "c", "d", "e" ], -2)
Apart from these functions, AQL also offers several language constructs (e.g.
*FOR*, *SORT*, *LIMIT*, *COLLECT*) to operate on lists.

View File

@ -5,8 +5,8 @@ AQL offers the following functions to let the user control the flow of operation
- *NOT_NULL(alternative, ...)*: Returns the first alternative that is not *null*,
and *null* if all alternatives are *null* themselves
- *FIRST_LIST(alternative, ...)*: Returns the first alternative that is a list, and
*null* if none of the alternatives is a list
- *FIRST_LIST(alternative, ...)*: Returns the first alternative that is an array, and
*null* if none of the alternatives is an array
- *FIRST_DOCUMENT(alternative, ...)*: Returns the first alternative that is a document,
and *null* if none of the alternatives is a document
@ -16,7 +16,7 @@ AQL offers the following functions to let the user control the flow of operation
Finally, AQL supports the following functions that do not belong to any of the other
function categories:
- *COLLECTIONS()*: Returns a list of collections. Each collection is returned as a document
- *COLLECTIONS()*: Returns an array of collections. Each collection is returned as a document
with attributes *name* and *_id*
- *CURRENT_USER()*: Returns the name of the current user. The current user is the user
@ -29,8 +29,8 @@ function categories:
in the specified collection. If there is a mismatch between the *collection* passed and
the collection specified in *id*, then *null* will be returned. Additionally, if the
*collection* matches the collection value specified in *id* but the document cannot be
found, *null* will be returned. This function also allows *id* to be a list of ids.
In this case, the function will return a list of all documents that could be found.
found, *null* will be returned. This function also allows *id* to be an array of ids.
In this case, the function will return an array of all documents that could be found.
*Examples*
@ -44,7 +44,7 @@ function categories:
a single parameter *id* as follows:
- *DOCUMENT(id)*: In this case, *id* must either be a document handle string
(consisting of collection name and document key) or a list of document handle strings, e.g.
(consisting of collection name and document key) or an array of document handle strings, e.g.
DOCUMENT("users/john")
DOCUMENT([ "users/john", "users/amy" ])

View File

@ -2,16 +2,16 @@
!SUBSECTION FOR
The *FOR* keyword can be to iterate over all elements of a list.
The *FOR* keyword can be to iterate over all elements of an array.
The general syntax is:
```
FOR variable-name IN expression
```
Each list element returned by *expression* is visited exactly once. It is
required that *expression* returns a list in all cases. The empty list is
allowed, too. The current list element is made available for further processing
Each array element returned by *expression* is visited exactly once. It is
required that *expression* returns an array in all cases. The empty array is
allowed, too. The current array element is made available for further processing
in the variable specified by *variable-name*.
```
@ -19,19 +19,19 @@ FOR u IN users
RETURN u
```
This will iterate over all elements from the list *users* (note: this list
This will iterate over all elements from the array *users* (note: this array
consists of all documents from the collection named "users" in this case) and
make the current list element available in variable *u*. *u* is not modified in
make the current array element available in variable *u*. *u* is not modified in
this example but simply pushed into the result using the *RETURN* keyword.
Note: When iterating over collection-based lists as shown here, the order of
Note: When iterating over collection-based arrays as shown here, the order of
documents is undefined unless an explicit sort order is defined using a *SORT*
statement.
The variable introduced by *FOR* is available until the scope the *FOR* is
placed in is closed.
Another example that uses a statically declared list of values to iterate over:
Another example that uses a statically declared array of values to iterate over:
```
FOR year IN [ 2011, 2012, 2013 ]
@ -39,7 +39,7 @@ FOR year IN [ 2011, 2012, 2013 ]
```
Nesting of multiple *FOR* statements is allowed, too. When *FOR* statements are
nested, a cross product of the list elements returned by the individual *FOR*
nested, a cross product of the array elements returned by the individual *FOR*
statements will be created.
```
@ -48,9 +48,9 @@ FOR u IN users
RETURN { "user" : u, "location" : l }
```
In this example, there are two list iterations: an outer iteration over the list
*users* plus an inner iteration over the list *locations*. The inner list is
traversed as many times as there are elements in the outer list. For each
In this example, there are two array iterations: an outer iteration over the array
*users* plus an inner iteration over the arry *locations*. The inner array is
traversed as many times as there are elements in the outer array. For each
iteration, the current values of *users* and *locations* are made available for
further processing in the variable *u* and *l*.
@ -68,8 +68,8 @@ RETURN expression
The *expression* returned by *RETURN* is produced for each iteration the
*RETURN* statement is placed in. That means the result of a *RETURN* statement
is always a list (this includes the empty list). To return all elements from
the currently iterated list without modification, the following simple form can
is always an array (this includes the empty array). To return all elements from
the currently iterated array without modification, the following simple form can
be used:
```
@ -104,7 +104,7 @@ FOR u IN users
RETURN u
```
In the above example, all list elements from *users* will be included that have
In the above example, all array elements from *users* will be included that have
an attribute *active* with value *true* and that have an attribute *age* with a
value less than *39* (including *null* ones). All other elements from *users*
will be skipped and not be included the result produced by *RETURN*.
@ -123,7 +123,7 @@ FOR u IN users
!SUBSECTION SORT
The *SORT* statement will force a sort of the list of already produced
The *SORT* statement will force a sort of the array of already produced
intermediate results in the current block. *SORT* allows specifying one or
multiple sort criteria and directions. The general syntax is:
@ -136,7 +136,7 @@ sort is the ascending order. To explicitly specify the sort direction, the
keywords *ASC* (ascending) and *DESC* can be used. Multiple sort criteria can be
separated using commas.
Note: when iterating over collection-based lists, the order of documents is
Note: when iterating over collection-based arrays, the order of documents is
always undefined unless an explicit sort order is defined using *SORT*.
```
@ -146,7 +146,7 @@ FOR u IN users
```
!SUBSECTION LIMIT
The *LIMIT* statement allows slicing the list of result documents using an
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
the specified number. Two general forms of *LIMIT* are followed:
@ -213,7 +213,7 @@ FOR u IN users
!SUBSECTION COLLECT
The *COLLECT* keyword can be used to group a list by one or multiple group
The *COLLECT* keyword can be used to group an array by one or multiple group
criteria. The two general syntaxes for *COLLECT* are:
```
@ -228,8 +228,8 @@ contains the group value.
The second form does the same as the first form, but additionally introduces a
variable (specified by *groups*) that contains all elements that fell into the
group. This works as follows: The *groups* variable is a list containing
as many elements as there are in the group. Each member of that list is
group. This works as follows: The *groups* variable is an array containing
as many elements as there are in the group. Each member of that array is
a JSON object in which the value of every variable that is defined in the
AQL query is bound to the corresponding attribute. Note that this considers
all variables that are defined before the *COLLECT* statement, but not those on
@ -244,9 +244,9 @@ FOR u IN users
RETURN { "city" : city, "users" : groups }
```
In the above example, the list of *users* will be grouped by the attribute
*city*. The result is a new list of documents, with one element per distinct
*city* value. The elements from the original list (here: *users*) per city are
In the above example, the array *users* will be grouped by the attribute
*city*. The result is a new array of documents, with one element per distinct
*city* value. The elements from the original array (here: *users*) per city are
made available in the variable *g*. This is due to the *INTO* clause.
*COLLECT* also allows specifying multiple group criteria. Individual group
@ -258,7 +258,7 @@ FOR u IN users
RETURN { "first" : first, "age" : age, "numUsers" : LENGTH(groups) }
```
In the above example, the list of *users* is grouped by first names and ages
In the above example, the array *users* is grouped by first names and ages
first, and for each distinct combination of first name and age, the number of
users found is returned.

View File

@ -16,8 +16,8 @@ The following comparison operators are supported:
- *<=* less or equal
- *>* greater than
- *>=* greater or equal
- *IN* test if a value is contained in a list
- *NOT IN* test if a value is not contained in a list
- *IN* test if a value is contained in an array
- *NOT IN* test if a value is not contained in an array
These operators accept any data types for the first and second operands.
@ -90,7 +90,7 @@ The *conversion to a boolean value* works as follows:
- boolean values remain unchanged
- all numbers unequal to zero are `true`, zero is `false`
- the empty string is `false`, all other strings are `true`
- lists (`[ ]`) and documents (`{ }`) are `true`, regardless of their contents
- arrays (`[ ]`) and objects / documents (`{ }`) are `true`, regardless of their contents
The result of *logical and* and *logical or* operations can now have any data
type and is not necessarily a boolean value.
@ -147,10 +147,10 @@ The *conversion to a numeric value* works as follows:
- string values are converted to a number if they contain a valid string representation
of a number. Any whitespace at the start or the end of the string is ignored. Strings
with any other contents are converted to `null`
- an empty list is converted to `0`, a list with one member is converted to the numeric
representation of its sole member. Lists with more members are converted
- an empty array is converted to `0`, an array with one member is converted to the numeric
representation of its sole member. Arrays with more members are converted
to `null`
- documents are converted to `null`
- objects / documents are converted to `null`
If the conversion to a number produces a value of `null` for one of the operands,
the result of the whole arithmetic operation will also be `null`. An arithmetic operation
@ -190,7 +190,7 @@ AQL supports expressing simple numeric ranges with the *..* operator.
This operator can be used to easily iterate over a sequence of numeric
values.
The *..* operator will produce a list of values in the defined range, with
The *..* operator will produce an array of values in the defined range, with
both bounding values included.
*Examples*

View File

@ -2,8 +2,8 @@
!SUBSECTION Result sets
The result of an AQL query is a list of values. The individual values in the
result list may or may not have a homogeneous structure, depending on what is
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
actually queried.
For example, when returning data from a collection with inhomogeneous documents
@ -30,7 +30,7 @@ still a document:
{ "id" : 3, "name" : "Amy" } ]
It is also possible to query just scalar values. In this case, the result set
is a list of scalars, and each result value is a scalar value:
is an array of scalars, and each result value is a scalar value:
FOR u IN users
RETURN u.id
@ -38,7 +38,7 @@ is a list of scalars, and each result value is a scalar value:
[ 1, 2, 3 ]
If a query does not produce any results because no matching data can be
found, it will produce an empty result list:
found, it will produce an empty result array:
[ ]

View File

@ -3,7 +3,7 @@
For string processing, AQL offers the following functions:
- *CONCAT(value1, value2, ... valuen)*: Concatenate the strings
passed as in *value1* to *valuen*. *null* values are ignored. List value arguments
passed as in *value1* to *valuen*. *null* values are ignored. Array value arguments
are expanded automatically, and their individual members will be concatenated.
/* "foobarbaz" */
@ -14,7 +14,7 @@ For string processing, AQL offers the following functions:
- *CONCAT_SEPARATOR(separator, value1, value2, ... valuen)*:
Concatenate the strings passed as arguments *value1* to *valuen* using the
*separator* string. *null* values are ignored. List value arguments
*separator* string. *null* values are ignored. Array value arguments
are expanded automatically, and their individual members will be concatenated.
/* "foo, bar, baz" */

View File

@ -19,8 +19,8 @@ will return a number value):
- *null* is converted to *false*.
- Numbers are converted to *true* if they are unequal to 0, and to *false* otherwise.
- Strings are converted to *true* if they are non-empty, and to *false* otherwise.
- Lists are always converted to *true*.
- Documents are always converted to *true*.
- Arrays are always converted to *true*.
- Objects / documents are always converted to *true*.
- *TO_NUMBER(value)*: Takes an input *value* of any type and converts it
into a numeric value as follows:
@ -31,28 +31,28 @@ will return a number value):
valid representation of a number. Whitespace at the start and end of the string
is allowed. String values that do not contain any valid representation of a number
will be converted to *null*.
- An empty list is converted to *0*, a list with one member is converted into the
result of `TO_NUMBER()` for its sole member. A list with two or more members is
- An empty array is converted to *0*, an array with one member is converted into the
result of `TO_NUMBER()` for its sole member. An array with two or more members is
converted to *null*.
- A document is converted to *null*.
- An object / document is converted to *null*.
- *TO_STRING(value)*: Takes an input *value* of any type and converts it
into a string value as follows:
- *null* is converted to the string *"null"*
- *false* is converted to the string *"false"*, *true* to the string *"true"*
- Numbers are converted to their string representations.
- An empty list is converted to the empty string. A list with one member is converted
to the result of `TO_STRING()` for its sole member. A list with two or more members
is converted to a comma-separated list with the string representation of its members.
- A document is converted to the string *[object Object]*.
- An empty array is converted to the empty string. An array with one member is converted
to the result of `TO_STRING()` for its sole member. An array with two or more members
is converted to a comma-separated array with the string representation of its members.
- An object / document is converted to the string *[object Object]*.
- *TO_LIST(value)*: Takes an input *value* of any type and converts it
into a list value as follows:
- *null* is converted to an empty list.
- Boolean values, numbers and strings are converted to a list containing the original
into an array value as follows:
- *null* is converted to an empty array.
- Boolean values, numbers and strings are converted to an array containing the original
value as its single element.
- Lists keep their original value.
- Documents are converted to a list containing their attribute values as list elements
- Arrays keep their original value.
- Objects / documents are converted to an array containing their attribute values as array elements
!SECTION Type check functions
@ -71,6 +71,6 @@ The following type check functions are available:
- *IS_STRING(value)*: Checks whether *value* is a *string* value
- *IS_LIST(value)*: Checks whether *value* is a *list* value
- *IS_LIST(value)*: Checks whether *value* is an *array* value
- *IS_DOCUMENT(value)*: Checks whether *value* is a *document* value
- *IS_DOCUMENT(value)*: Checks whether *value* is an *object* / *document* value

View File

@ -124,7 +124,7 @@ FOR u IN users
!SUBSECTION Aggregation
So far we only grouped data without aggregation. Adding aggregation is simple in AQL,
as all that needs to be done is to run an aggregate function on the list created by
as all that needs to be done is to run an aggregate function on the array created by
the *INTO* clause of a *COLLECT* statement:
```js
@ -173,13 +173,13 @@ FOR u IN users
]
```
We have used the function *LENGTH* here (it returns the length of a list). This is the
We have used the function *LENGTH* here (it returns the length of a array). This is the
equivalent to SQL's `SELECT g, COUNT(*) FROM ... GROUP BY g`.
In addition to *LENGTH* AQL also provides *MAX*, *MIN*, *SUM* and *AVERAGE* as
basic aggregation functions.
In AQL all aggregation functions can be run on lists only. If an aggregation function
is run on anything that is not a list, an error will be occur and the query will fail.
In AQL all aggregation functions can be run on arrays only. If an aggregation function
is run on anything that is not an array, an error will occur and the query will fail.
!SUBSECTION Post-filtering aggregated data

View File

@ -5,8 +5,8 @@ understandability the query results are also included directly below each query.
!SECTION Simple queries
Following is a query that returns a string value. The result string is contained in a list
because the result of every valid query is a list:
Following is a query that returns a string value. The result string is contained in an array
because the result of every valid query is an array:
```js
RETURN "this will be returned"
@ -15,7 +15,7 @@ RETURN "this will be returned"
]
```
Here is a query that creates the cross products of two lists and runs a projection
Here is a query that creates the cross products of two arrays and runs a projection
on it, using a few of AQL's built-in functions:
```js

View File

@ -176,7 +176,7 @@ Returns all available graphs.
Return all shortest paths An optional options JSON object can be specified to control the result. options can have the following sub-attributes:
grouped: if not specified or set to false, the result will be a flat list. If set to true, the result will be a list containing list of paths, grouped for each combination of source and target.
grouped: if not specified or set to false, the result will be a flat array. If set to true, the result will be an array containing arrays of paths, grouped for each combination of source and target.
threshold: if not specified, all paths will be returned. If threshold is true, only paths with a minimum length of 3 will be returned
`graph.measurement( measurement)`
@ -249,4 +249,4 @@ Calculates the normalized degree, closeness, betweenness or eccentricity of all
@copydetails JSF_Graph_prototype_normalizedMeasurement
@CLEARPAGE
-->
-->

View File

@ -65,7 +65,7 @@ Examples
`vertex.edges()`
Returns a list of in- or outbound edges of the vertex.
Returns an array of in- or outbound edges of the vertex.
*Examples*
@ -98,7 +98,7 @@ Returns the identifier of the vertex. If the vertex was deleted, then undefined
`vertex.getInEdges( label, ...)`
Returns a list of inbound edges of the vertex with given label(s).
Returns an array of inbound edges of the vertex with given label(s).
*Examples*
@ -128,7 +128,7 @@ Returns a list of inbound edges of the vertex with given label(s).
`vertex.getOutEdges( label, ...)`
Returns a list of outbound edges of the vertex with given label(s).
Returns an array of outbound edges of the vertex with given label(s).
*Examples*
@ -158,7 +158,7 @@ Returns a list of outbound edges of the vertex with given label(s).
`vertex.getEdges( label, ...)`
Returns a list of in- or outbound edges of the vertex with given label(s).
Returns an array of in- or outbound edges of the vertex with given label(s).
`vertex.getProperty( name)`
@ -314,4 +314,4 @@ Calculates the eccentricity, betweenness or closeness of the vertex
@CLEARPAGE
@anchor JSModuleGraphVertexMeasurement
@copydetails JSF_Vertex_prototype_measurement
-->
-->

View File

@ -5,7 +5,7 @@ ArangoDB is a database that serves documents to clients.
* A *document* contains zero or more attributes, each one of these
attributes has a value. A value can either be an atomic type, i. e.
integer, strings, boolean, a list or an embedded document. Documents
integer, strings, boolean, an array or an embedded document. Documents
are normally represented as JSON objects
* Documents are grouped into *collections*. A collection contains zero
or more documents
@ -164,7 +164,7 @@ The last document was a mistake so let's delete it:
]
Now we want to look for a person with a given name. We can use
*byExample* for this. The method returns a list of documents
*byExample* for this. The method returns an array of documents
matching a given example.
arangosh> db.example.byExample({ name: "Jane Smith" }).toArray()

View File

@ -200,7 +200,7 @@ Deletes a job with the given job id.
Returns *true* if the job was deleted successfully. If the job did not exist, it returns *false* instead.
!SECTION Fetching a list of jobs in a queue
!SECTION Fetching an arry of jobs in a queue
*Examples*
@ -215,7 +215,7 @@ assertEqual(queue.progress("log").length, 0);
assertEqual(queue.complete("log").length, 1);
```
!SUBSECTION Fetching a list of pending jobs in a queue
!SUBSECTION Fetching an array of pending jobs in a queue
`Queue::pending([type])`
@ -225,7 +225,7 @@ Returns an array of job ids of jobs in the given queue with the status *"pending
* *type* (optional): the name of the job type to filter the results.
!SUBSECTION Fetching a list of jobs that are currently in progress
!SUBSECTION Fetching an array of jobs that are currently in progress
`Queue::progress([type])`
@ -235,7 +235,7 @@ Returns an array of job ids of jobs in the given queue with the status *"progres
* *type* (optional): the name of the job type to filter the results.
!SUBSECTION Fetching a list of completed jobs in a queue
!SUBSECTION Fetching an array of completed jobs in a queue
`Queue::complete([type])`
@ -245,7 +245,7 @@ Returns an array of job ids of jobs in the given queue with the status *"complet
* *type* (optional): the name of the job type to filter the results.
!SUBSECTION Fetching a list of failed jobs in a queue
!SUBSECTION Fetching an array of failed jobs in a queue
`Queue::failed([type])`
@ -255,7 +255,7 @@ Returns an array of job ids of jobs in the given queue with the status *"failed"
* *type* (optional): the name of the job type to filter the results.
!SUBSECTION Fetching a list of all jobs in a queue
!SUBSECTION Fetching an array of all jobs in a queue
`Queue::all([type])`

View File

@ -99,7 +99,7 @@ A repository is an object that wraps access to a collection (or multiple
collections if you want), whereas controller.collection returns the
collection itself. That's the main difference.
To return a list of users from a controller using a repository, you
To return an array of users from a controller using a repository, you
could use it like this:
```js

View File

@ -190,8 +190,8 @@ ArangoDB will automatically handle CORS requests as follows:
body. ArangoDB will return the following headers in the response:
* *access-control-allow-origin*: will contain the value that the client
provided in the *Origin* header of the request
* *access-control-allow-methods*: will contain a list of all HTTP methods
generally supported by ArangoDB. This list does not depend on the URL the
* *access-control-allow-methods*: will contain an array of all HTTP methods
generally supported by ArangoDB. This array does not depend on the URL the
client requested and is the same for all CORS requests.
* *access-control-allow-headers*: will contain exactly the value that
the client has provided in the *Access-Control-Request-Header* header

View File

@ -2,9 +2,9 @@
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
line of the HTTP POST request body must be a JSON list containing the attribute
line of the HTTP POST request body must be a JSON array containing the attribute
names for the documents that follow. The following lines are interpreted as the
document data. Each document must be a JSON list of values. No attribute names
document data. Each document must be a JSON array of values. No attribute names
are needed or allowed in this data section.
*Examples*
@ -30,8 +30,8 @@ returned in the *errors* attribute. The number of empty lines in the input file
will be returned in the *empty* attribute.
If the *details* parameter was set to *true* in the request, the response will
also contain an attribute *details* which is a list of details about errors that
occurred on the server side during the import. This list might be empty if no
also contain an attribute *details* which is an array of details about errors that
occurred on the server side during the import. This array might be empty if no
errors occurred.
!SECTION Importing into Edge Collections

View File

@ -14,7 +14,7 @@ Example input data:
To use this method, the *type* URL parameter should be set to *documents*.
It is also possible to upload self-contained JSON documents that are embedded
into a JSON list. Each element from the list will be treated as a document and
into a JSON array. Each element from the array will be treated as a document and
be imported.
Example input data for this case:
@ -29,15 +29,15 @@ Example input data for this case:
This format does not require each document to be on a separate line, and any
whitespace in the JSON data is allowed. It can be used to import a
JSON-formatted result list (e.g. from arangosh) back into ArangoDB. Using this
format requires ArangoDB to parse the complete list and keep it in memory for
JSON-formatted result array (e.g. from arangosh) back into ArangoDB. Using this
format requires ArangoDB to parse the complete array and keep it in memory for
the duration of the import. This might be more resource-intensive than the
line-wise processing.
To use this method, the *type* URL parameter should be set to *array*.
Setting the *type* URL parameter to *auto* will make the server auto-detect whether
the data are line-wise JSON documents (type = documents) or a JSON list (type = array).
the data are line-wise JSON documents (type = documents) or a JSON array (type = array).
*Examples*
@ -61,8 +61,8 @@ returned in the *errors* attribute. There will also be an attribute *empty* in
the response, which will contain a value of *0*.
If the *details* parameter was set to *true* in the request, the response will
also contain an attribute *details* which is a list of details about errors that
occurred on the server side during the import. This list might be empty if no
also contain an attribute *details* which is an array of details about errors that
occurred on the server side during the import. This array might be empty if no
errors occurred.

View File

@ -9,10 +9,10 @@ import the data:
* self-contained JSON documents: in this case, each document contains all
attribute names and values. Attribute names may be completely different
among the documents uploaded
* attribute names plus document data: in this case, the first document must
be a JSON list containing the attribute names of the documents that follow.
The following documents must be lists containing only the document data.
Data will be mapped to the attribute names by attribute positions.
* attribute names plus document data: in this case, the first array must
contain the attribute names of the documents that follow. The following arrays
containing only the attribute values. Attribute values will be mapped to the
attribute names by positions.
The endpoint address is */_api/import* for both input mechanisms. Data must be
sent to this URL using an HTTP POST request. The data to import must be
@ -38,6 +38,6 @@ might have been imported.
The *details* URL parameter can be set to *true* to make the import API return
details about documents that could not be imported. If *details* is *true*, then
the result will also contain a *details* attribute which is a list of detailed
the result will also contain a *details* attribute which is an array of detailed
error messages. If the *details* is set to *false* or omitted, no details will be
returned.

View File

@ -3,9 +3,9 @@
If a [database name](../Glossary/README.html#database_name) is present in the URI as above, ArangoDB will consult the database-to-endpoint
mapping for the current endpoint, and validate if access to the database is allowed on the
endpoint.
If the endpoint is not restricted to a list of databases, ArangoDB will continue with the
regular authentication procedure. If the endpoint is restricted to a list of specified databases,
ArangoDB will check if the requested database is in the list. If not, the request will be turned
If the endpoint is not restricted to an array of databases, ArangoDB will continue with the
regular authentication procedure. If the endpoint is restricted to an array of specified databases,
ArangoDB will check if the requested database is in the array. If not, the request will be turned
down instantly. If yes, then ArangoDB will continue with the regular authentication procedure.
If the request URI was *http:// localhost:8529/_db/mydb/...*, then the request to *mydb* will be
@ -26,9 +26,9 @@ In case no database name is specified in the request URI, ArangoDB will derive t
name from the endpoint-to-database mapping of the endpoint
the connection was coming in on.
If the endpoint is not restricted to a list of databases, ArangoDB will assume the *_system*
If the endpoint is not restricted to an array of databases, ArangoDB will assume the *_system*
database. If the endpoint is restricted to one or multiple databases, ArangoDB will assume
the first name from the list.
the first name from the array.
Following is an overview of which database name will be assumed for different endpoint-to-database
mappings in case no database name is specified in the URI:
@ -41,4 +41,4 @@ Endpoint-to-database mapping Database
[ "_system", "mydb" ] _system
[ "mydb" ] mydb
[ "mydb", "_system" ] mydb
```
```

View File

@ -4,7 +4,7 @@ This is an introduction to ArangoDB's Http interface for managing databases.
The HTTP interface for databases provides operations to create and drop
individual databases. These are mapped to the standard HTTP methods *POST*
and *DELETE*. There is also the *GET* method to retrieve a list of existing
and *DELETE*. There is also the *GET* method to retrieve an array of existing
databases.
Please note that all database management operations can only be accessed via
@ -25,4 +25,4 @@ the default database (*_system*) and none of the other databases.
@startDocuBlock JSF_get_api_database_new
<!-- js/actions/api-database.js -->
@startDocuBlock JSF_get_api_database_delete
@startDocuBlock JSF_get_api_database_delete

View File

@ -20,7 +20,7 @@ Lists all graph names stored in this database.ssss
@RESTRETURNCODES
@RESTRETURNCODE{200}
Returned if the module is available and the graphs could be listed.
Is returned if the module is available and the graphs could be listed.
@EXAMPLES
@ -39,15 +39,15 @@ The creation of a graph requires the name of the graph and a definition of its e
Name of the graph.
@RESTPARAM{edgeDefinitions, string, optional}
A list of definitions for the edges, see [edge definitions](../General-Graphs/Management.md#edge_definitions).
An array of definitions for the edges, see [edge definitions](../General-Graphs/Management.md#edge_definitions).
@RESTPARAM{orphanCollections, string, optional}
A list of additional vertex collections.
An array of additional vertex collections.
@RESTRETURNCODES
@RESTRETURNCODE{201}
Returned if the graph could be listed created.
Is returned if the graph could be created.
The body contains the graph configuration that has been stored.
@RESTRETURNCODE{409}
@ -126,7 +126,7 @@ The name of the graph.
@RESTRETURNCODES
@RESTRETURNCODE{200}
Returned if the collections could be listed.
Is returned if the collections could be listed.
@RESTRETURNCODE{404}
Returned if no graph with this name could be found.
@ -212,7 +212,7 @@ The name of the graph.
@RESTRETURNCODES
@RESTRETURNCODE{200}
Returned if the collections could be listed.
Is returned if the edge definitions could be listed.
@RESTRETURNCODE{404}
Returned if no graph with this name could be found.
@ -227,8 +227,8 @@ Returned if no graph with this name could be found.
@RESTDESCRIPTION
Adds an additional edge definition to the graph.
This edge definition has to contain a *collection* a list of each *from* and *to* vertex collections.
A edge definition can only be added if this definition is either not used in any other graph, or it is used with exactly the same definition.
This edge definition has to contain a *collection* and an array of each *from* and *to* vertex collections.
An edge definition can only be added if this definition is either not used in any other graph, or it is used with exactly the same definition.
It is not possible to store a definition "e" from "v1" to "v2" in the one graph, and "e" from "v2" to "v1" in the other graph.
@RESTURLPARAMS

View File

@ -24,18 +24,18 @@ Wait until edge has been sync to disk.
`edge (json,required)`
The call expects a JSON hash array as body with the edge properties:
The call expects a JSON object as body with the edge properties:
!SUBSECTION Description
Creates an edge in a graph.
The call expects a JSON hash array as body with the edge properties:
The call expects a JSON object as body with the edge properties:
* _key: The name of the edge (optional, if [edge collection](../Glossary/README.html#edge_collection) allows user defined keys).
* _from: The name of the from vertex.
* _to: The name of the to vertex.
* $label: A label for the edge (optional).
Returns an object with an attribute edge containing the list of all edge properties.
Returns an object with an attribute edge containing the array of all edge properties.
!SUBSECTION Return codes
@ -99,7 +99,7 @@ if-match (string,optional)
If the "If-Match" header is given, then it must contain exactly one etag. The document is returned, if it has the same revision ad the given etag. Otherwise a HTTP 412 is returned. As an alternative you can supply the etag in an attribute rev in the URL.
!SUBSECTION Description
Returns an object with an attribute edge containing a list of all edge properties.
Returns an object with an attribute edge containing an array of all edge properties.
!SUBSECTION Return codes
@ -169,7 +169,7 @@ Revision of an edge
`edge (json,required)`
The call expects a JSON hash array as body with the new edge properties.
The call expects a JSON object as body with the new edge properties.
!SUBSECTION HTTP header parameters
@ -179,9 +179,9 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
!SUBSECTION Description
Replaces the optional edge properties.
The call expects a JSON hash array as body with the new edge properties.
The call expects a JSON object as body with the new edge properties.
Returns an object with an attribute edge containing a list of all edge properties.
Returns an object with an attribute edge containing an array of all edge properties.
!SUBSECTION Return codes
@ -255,7 +255,7 @@ Modify the behavior of the patch command to remove any attribute
`edge-properties (json,required)`
The call expects a JSON hash array as body with the properties to patch.
The call expects a JSON object as body with the properties to patch.
!SUBSECTION HTTP header parameters
@ -268,7 +268,7 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
Partially updates the edge properties.
Setting an attribute value to null in the patch document will cause a value of null be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter keepNull can be used with a value of false. This will modify the behavior of the patch command to remove any attributes from the existing document that are contained in the patch document with an attribute value of null.
Returns an object with an attribute edge containing a list of all edge properties.
Returns an object with an attribute edge containing an array of all edge properties.
!SUBSECTION Return codes
@ -392,12 +392,12 @@ The name of the graph
`graph (json,required)`
The call expects a JSON hash array as body to filter the result:
The call expects a JSON object as body to filter the result:
!SUBSECTION Description
Returns a cursor.
The call expects a JSON hash array as body to filter the result:
The call expects a JSON object as body to filter the result:
* batchSize: the batch size of the returned cursor
* limit: limit the result size
@ -500,13 +500,13 @@ The name of the vertex
`edge-properties (json,required)`
The call expects a JSON hash array as body to filter the result:
The call expects a JSON object as body to filter the result:
!SUBSECTION Description
Returns a cursor.
The call expects a JSON hash array as body to filter the result:
The call expects a JSON object as body to filter the result:
* batchSize: the batch size of the returned cursor
* limit: limit the result size
@ -607,4 +607,4 @@ content-type: application/json; charset=utf-8
@copydetails JSF_post_graph_vertex_edges
@BNAVIGATE_HttpGraph
-->
-->

View File

@ -17,12 +17,12 @@ Wait until document has been sync to disk.
`graph (json,required)`
The call expects a JSON hash array as body with the following attributes: _key: The name of the new graph. vertices: The name of the vertices collection. edges: The name of the egde collection.
The call expects a JSON object as body with the following attributes: _key: The name of the new graph. vertices: The name of the vertices collection. edges: The name of the egde collection.
!SUBSECTION Description
Creates a new graph.
Returns an object with an attribute graph containing a list of all graph properties.
Returns an object with an attribute *graph* containing an array of all graph properties.
!SUBSECTION Return codes
@ -83,15 +83,15 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
!SUBSECTION Description
If graph-name is specified, returns an object with an attribute graph containing a JSON hash with all properties of the specified graph.
If graph-name is specified, returns an object with an attribute graph containing a JSON array with all properties of the specified graph.
If graph-name is not specified, returns a list of graph objects.
If graph-name is not specified, returns an array of graph objects.
!SUBSECTION Return codes
`HTTP 200`
is returned if the graph was found (in case graph-name was specified) or the list of graphs was assembled successfully (in case graph-name was not specified).
is returned if the graph was found (in case graph-name was specified) or the array of graphs was assembled successfully (in case graph-name was not specified).
`HTTP 404`

View File

@ -24,14 +24,14 @@ Wait until document has been sync to disk.
`vertex (json,required)`
The call expects a JSON hash array as body with the vertex properties:
The call expects a JSON object as body with the vertex properties:
_key: The name of the vertex (optional).
further optional attributes.
!SUBSECTION Description
Creates a vertex in a graph.
Returns an object with an attribute vertex containing a list of all vertex properties.
Returns an object with an attribute *vertex* containing a array of all vertex properties.
!SUBSECTION Return codes
@ -95,7 +95,7 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
!SUBSECTION Description
Returns an object with an attribute vertex containing a list of all vertex properties.
Returns an object with an attribute *vertex* containing an array of all vertex properties.
!SUBSECTION Return codes
@ -164,7 +164,7 @@ Revision of a vertex
`vertex (json,required)`
The call expects a JSON hash array as body with the new vertex properties.
The call expects a JSON object as body with the new vertex properties.
!SUBSECTION HTTP header parameters
@ -175,7 +175,7 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
!SUBSECTION Description
Replaces the vertex properties.
Returns an object with an attribute vertex containing a list of all vertex properties.
Returns an object with an attribute *vertex* containing an array of all vertex properties.
!SUBSECTION Return codes
@ -247,7 +247,7 @@ Modify the behavior of the patch command to remove any attribute
`graph (json,required)`
The call expects a JSON hash array as body with the properties to patch.
The call expects a JSON object as body with the properties to patch.
!SUBSECTION HTTP header parameters
@ -260,7 +260,7 @@ If the "If-Match" header is given, then it must contain exactly one etag. The do
Partially updates the vertex properties.
Setting an attribute value to null in the patch document will cause a value of null be saved for the attribute by default. If the intention is to delete existing attributes with the patch command, the URL parameter keepNull can be used with a value of false. This will modify the behavior of the patch command to remove any attributes from the existing document that are contained in the patch document with an attribute value of null.
Returns an object with an attribute vertex containing a list of all vertex properties.
Returns an object with an attribute *vertex* containing an array of all vertex properties.
!SUBSECTION Return codes
@ -405,4 +405,4 @@ content-type: application/json; charset=utf-8
@CLEARPAGE
@anchor A_JSF_DELETE_graph_vertex
@copydetails JSF_delete_graph_vertex
-->
-->

View File

@ -18,13 +18,13 @@ fulfilling these requirements are rejected.
`collection.ensureGeoIndex( location)`
Creates a geo-spatial index on all documents using location as path to the coordinates. The value of the attribute must be a list with at least two double values. The list must contain the latitude (first value) and the longitude (second value). All documents, which do not have the attribute path or with value that are not suitable, are ignored.
Creates a geo-spatial index on all documents using location as path to the coordinates. The value of the attribute must be an array with at least two numeric values. The array must contain the latitude (first value) and the longitude (second value). All documents, which do not have the attribute path or with value that are not suitable, are ignored.
In case that the index was successfully created, the index identifier is returned.
`collection.ensureGeoIndex( location, true)`
As above which the exception, that the order within the list is longitude followed by latitude. This corresponds to the format described in
As above which the exception, that the order within the array is longitude followed by latitude. This corresponds to the format described in
http://geojson.org/geojson-spec.html
@ -36,18 +36,17 @@ In case that the index was successfully created, the index identifier is returne
*Examples*
Create an geo index for a list attribute:
Create an geo index for an array attribute:
```
arangosh> db.geo.ensureGeoIndex("loc");
{ "id" : "geo/47772301", "type" : "geo1", "geoJson" : false, "fields" : ["loc"], "isNewlyCreated" : true }
arangosh> for (i = -90; i <= 90; i += 10) {
.......> for (j = -180; j <= 180; j += 10) {
.......> db.geo.save({ name : "Name/" + i + "/" + j,
.......> loc: [ i, j ] });
.......> }
.......> }
for (j = -180; j <= 180; j += 10) {
db.geo.save({ name : "Name/" + i + "/" + j, loc: [ i, j ] });
}
}
arangosh> db.geo.count();
703
@ -70,12 +69,10 @@ arangosh> db.geo2.ensureGeoIndex("location.latitude", "location.longitude");
{ "id" : "geo2/1070652", "type" : "geo2", "fields" : ["location.latitude", "location.longitude"], "isNewlyCreated" : true }
arangosh> for (i = -90; i <= 90; i += 10) {
.......> for (j = -180; j <= 180; j += 10) {
.......> db.geo2.save({ name : "Name/" + i + "/" + j,
.......> location: { latitude : i,
.......> longitude : j } });
.......> }
.......> }
for (j = -180; j <= 180; j += 10) {
db.geo2.save({ name : "Name/" + i + "/" + j, location: { latitude : i, longitude : j } });
}
}
arangosh> db.geo2.near(0,0).limit(3).toArray();
[
@ -133,16 +130,14 @@ Returns a geo index object if an index was found. The near or within operators c
*Examples*
Assume you have a location stored as list in the attribute home and a destination stored in the attribute work. Then you can use the geo operator to select which geo-spatial attributes (and thus which index) to use in a near query.
Assume you have a location stored as array in the attribute *home* and a destination stored in the attribute *work*. Then you can use the geo operator to select which geo-spatial attributes (and thus which index) to use in a near query.
```
arangosh> for (i = -90; i <= 90; i += 10) {
.......> for (j = -180; j <= 180; j += 10) {
.......> db.complex.save({ name : "Name/" + i + "/" + j,
.......> home : [ i, j ],
.......> work : [ -i, -j ] });
.......> }
.......> }
for (j = -180; j <= 180; j += 10) {
db.complex.save({ name : "Name/" + i + "/" + j, home : [ i, j ], work : [ -i, -j ] });
}
}
arangosh> db.complex.near(0, 170).limit(5);
exception in file '/simple-query' at 1018,5: a geo-index must be known
@ -173,7 +168,7 @@ arangosh> db.complex.geo("work").near(0, 170).limit(5).toArray();
`collection.near( latitude, longitude)`
The returned list is sorted according to the distance, with the nearest document to the coordinate ( latitude, longitude) coming first. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. It is possible to change the limit using the limit operator.
The returned array is sorted according to the distance, with the nearest document to the coordinate ( latitude, longitude) coming first. If there are near documents of equal distance, documents are chosen randomly from this set until the limit is reached. It is possible to change the limit using the limit operator.
In order to use the near operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more then one geo-spatial index, you can use the geo operator to select a particular index.
@ -218,7 +213,7 @@ arangosh> db.geo.near(0,0).distance().limit(2).toArray();
`collection.within( latitude, longitude, radius)`
This will find all documents within a given radius around the coordinate ( latitude, longitude). The returned list is sorted by distance, beginning with the nearest document.
This will find all documents within a given radius around the coordinate ( latitude, longitude). The returned array is sorted by distance, beginning with the nearest document.
In order to use the within operator, a geo index must be defined for the collection. This index also defines which attribute holds the coordinates for the document. If you have more then one geo-spatial index, you can use the geo operator to select a particular index.

View File

@ -172,7 +172,7 @@ Returns all available graphs.
Return all shortest paths An optional options JSON object can be specified to control the result. options can have the following sub-attributes:
* grouped: if not specified or set to false, the result will be a flat list. If set to true, the result will be a list containing list of paths, grouped for each combination of source and target.
* grouped: if not specified or set to false, the result will be a flat array. If set to true, the result will be an array containing arrays of paths, grouped for each combination of source and target.
* threshold: if not specified, all paths will be returned. If threshold is true, only paths with a minimum length of 3 will be returned
`graph.measurement( measurement)`

View File

@ -65,7 +65,7 @@ Creates a new edge from vertex to peer with given label and properties defined i
`vertex.edges()`
Returns a list of in- or outbound edges of the vertex.
Returns an array of in- or outbound edges of the vertex.
*Examples*
@ -98,7 +98,7 @@ Returns the identifier of the vertex. If the vertex was deleted, then undefined
`vertex.getInEdges( label, ...)`
Returns a list of inbound edges of the vertex with given label(s).
Returns an array of inbound edges of the vertex with given label(s).
*Examples*
@ -128,7 +128,7 @@ Returns a list of inbound edges of the vertex with given label(s).
`vertex.getOutEdges( label, ...)`
Returns a list of outbound edges of the vertex with given label(s).
Returns an array of outbound edges of the vertex with given label(s).
*Examples*
@ -158,7 +158,7 @@ Returns a list of outbound edges of the vertex with given label(s).
`vertex.getEdges( label, ...)`
Returns a list of in- or outbound edges of the vertex with given label(s).
Returns an array of in- or outbound edges of the vertex with given label(s).
`vertex.getProperty( name)`
@ -312,4 +312,4 @@ Calculates the eccentricity, betweenness or closeness of the vertex
@CLEARPAGE
@anchor JSModuleGraphVertexMeasurement
@copydetails JSF_Vertex_prototype_measurement
-->
-->

View File

@ -147,7 +147,7 @@ Note that unregistering a non-existing task will throw an exception.
To get an overview of which tasks are registered, there is the *get*
method. If the *get* method is called without any arguments, it will
return a list of all tasks:
return an array of all tasks:
```js
var tasks = require("org/arangodb/tasks");

View File

@ -147,23 +147,23 @@ The following other date functions are also available:
The following other AQL functions have been added in ArangoDB 2.1:
- `FLATTEN`: this function can turn a list of sub-lists into a single flat list. All
list elements in the original list will be expanded recursively up to a configurable
depth. The expanded values will be added to the single result list.
- `FLATTEN`: this function can turn an array of sub-arrays into a single flat array. All
array elements in the original array will be expanded recursively up to a configurable
depth. The expanded values will be added to the single result array.
Example:
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ])
will expand the sub-lists on the first level and produce:
will expand the sub-arrays on the first level and produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, [ 9, 10 ] ]
To fully flatten the list, the maximum depth can be specified (e.g. with a value of `2`):
To fully flatten the array, the maximum depth can be specified (e.g. with a value of `2`):
FLATTEN([ 1, 2, [ 3, 4 ], 5, [ 6, 7 ], [ 8, [ 9, 10 ] ], 2)
This will fully expand the sub-lists and produce:
This will fully expand the sub-arrays and produce:
[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
@ -296,4 +296,4 @@ source. For instance GNU CC of at least version 4.8.
ArangoDB now supports both versions:
db._createStatement(queryString);
db._createStatement({ query: queryString });
db._createStatement({ query: queryString });

View File

@ -58,7 +58,7 @@ being executable:
* added AQL TRANSLATE function
This function can be used to perform lookups from static lists, e.g.
This function can be used to perform lookups from static objects, e.g.
LET countryNames = { US: "United States", UK: "United Kingdom", FR: "France" }
RETURN TRANSLATE("FR", countryNames)

View File

@ -76,22 +76,22 @@ The following AQL string functions have been added:
of a search string
- `FIND_LAST(value, search, start, end)`: finds the last occurence of a
search string
- `SPLIT(value, separator, limit) `: splits a string into a list,
- `SPLIT(value, separator, limit) `: splits a string into an array,
using a separator
- `SUBSTITUTE(value, search, replace, limit)`: replaces characters
or strings inside another
The following other AQL functions have been added:
- `VALUES(document)`: returns the values of a document as a list (this is
- `VALUES(document)`: returns the values of an object as a array (this is
the counterpart to the already existing `ATTRIBUTES` function)
- `ZIP(attributes, values)`: returns a document constructed from attributes
- `ZIP(attributes, values)`: returns an object constructed from attributes
and values passed in separate parameters
- `PERCENTILE(values, n, method)`: returns the nths percentile of the
values provided, using rank or interpolation method
The already existing functions `CONCAT` and `CONCAT_SEPARATOR` now support
list arguments, e.g.:
array arguments, e.g.:
/* "foobarbaz" */
CONCAT([ 'foo', 'bar', 'baz'])
@ -104,7 +104,7 @@ list arguments, e.g.:
In previous versions of ArangoDB, AQL queries aborted with an exception in many
situations and threw a runtime exception. For example, exceptions were thrown when
trying to find a value using the `IN` operator in a non-list element, when trying
trying to find a value using the `IN` operator in a non-array element, when trying
to use non-boolean values with the logical operands `&&` or `||` or `!`, when using
non-numeric values in arithmetic operations, when passing wrong parameters into
functions etc.
@ -130,7 +130,7 @@ query optimizer to perform much more transformations in the query without
changing its overall result.
Here is a summary of changes:
- when a non-list value is used on the right-hand side of the `IN` operator, the
- when a non-array value is used on the right-hand side of the `IN` operator, the
result will be `false` in ArangoDB 2.3, and no exception will be thrown.
- the boolean operators `&&` and `||` do not throw in ArangoDB 2.3 if any of the
operands is not a boolean value. Instead, they will perform an implicit cast of

View File

@ -24,7 +24,7 @@ renaming and changing collections and indexes.
When the replication logger was used, it logged all these write operations for the
database in its own event log, which was a system collection named *_replication*.
Reading the events sequentially from the *_replication* collection provided a list of
Reading the events sequentially from the *_replication* collection provides a list of
all write operations carried out in the master database. Replication clients could then
request these events from the logger and apply them on their own.
@ -359,7 +359,7 @@ Any local instances of the collections and all their data are removed! Only exec
command if you are sure you want to remove the local data!
As *sync* does a full synchronization, it might take a while to execute.
When *sync* completes successfully, it show a list of collections it has synchronized in its
When *sync* completes successfully, it returns an array of collections it has synchronized in its
*collections* attribute. It will also return the master database's last log tick value
at the time the *sync* was started on the master. The tick value is contained in the *lastLogTick*
attribute of the *sync* command:

View File

@ -67,8 +67,8 @@
* [String](Aql/StringFunctions.md)
* [Numeric](Aql/NumericFunctions.md)
* [Date](Aql/DateFunctions.md)
* [List](Aql/ListFunctions.md)
* [Document](Aql/DocumentFunctions.md)
* [Array](Aql/ArrayFunctions.md)
* [Object / Document](Aql/DocumentFunctions.md)
* [Geo](Aql/GeoFunctions.md)
* [Fulltext](Aql/FulltextFunctions.md)
* [Graph](Aql/GraphFunctions.md)

View File

@ -24,7 +24,7 @@ db.e.inEdges('v/world').forEach(function(edge) {
```
*inEdges* will give us all ingoing edges for the specified vertex *v/world*. The result
is a JavaScript list, that we can iterate over and print the results:
is a JavaScript array that we can iterate over and print the results:
```js
v/continent-africa -> is-in -> v/world
@ -35,7 +35,7 @@ v/continent-europe -> is-in -> v/world
v/continent-north-america -> is-in -> v/world
```
**Note**: *edges*, *inEdges*, and *outEdges* return a list of edges. If we want to retrieve
**Note**: *edges*, *inEdges*, and *outEdges* return an array of edges. If we want to retrieve
the linked vertices, we can use each edges' *_from* and *_to* attributes as follows:
```js

View File

@ -78,7 +78,7 @@ require("internal").print(result.visited.vertices.map(function(vertex) {
}));
```
The result is a list of vertices that were visited during the traversal, starting at the
The result is an array of vertices that were visited during the traversal, starting at the
start vertex (i.e. *v/world* in our example):
```js
@ -95,7 +95,7 @@ start vertex (i.e. *v/world* in our example):
**Note**: The result is limited to vertices directly connected to the start vertex. We
achieved this by setting the *maxDepth* attribute to *1*. Not setting it would return the
full list of vertices.
full array of vertices.
!SUBSECTION Traversal Direction
@ -213,7 +213,7 @@ require("internal").print(result.visited.vertices.map(function(vertex) {
}));
```
The result will be a longer list, assembled in depth-first, pre-order order. For
The result will be a longer array, assembled in depth-first, pre-order order. For
each continent found, the traverser will descend into linked countries, and then into
the linked capital:
@ -438,8 +438,8 @@ var config = {
The above filter function will exclude all vertices that do not have a *type* value of
*capital*. The filter function will be called for each vertex found during the traversal.
It will receive the traversal configuration, the current vertex, and the full path from
the traversal start vertex to the current vertex. The path consists of a list of edges,
and a list of vertices. We could also filter everything but capitals by checking the
the traversal start vertex to the current vertex. The path consists of an array of edges,
and an array of vertices. We could also filter everything but capitals by checking the
length of the path from the start vertex to the current vertex. Capitals will have a
distance of 3 from the *v/world* start vertex
(capital -> is-in -> country -> is-in -> continent -> is-in -> world):
@ -476,7 +476,7 @@ var config = {
}
```
It is also possible to combine *exclude* and *prune* by returning a list with both
It is also possible to combine *exclude* and *prune* by returning an array with both
values:
```js
@ -536,7 +536,7 @@ It is the expander's responsibility to return all edges and vertices directly
connected to the current vertex (which is passed via the *vertex* variable).
The full path from the start vertex up to the current vertex is also supplied via
the *path* variable.
An expander is expected to return a list of objects, which need to have an *edge*
An expander is expected to return an array of objects, which need to have an *edge*
and a *vertex* attribute each.
**Note**: If you want to rely on a particular order in which the edges
@ -620,7 +620,7 @@ var config = {
var outEdges = datasource.getOutEdges(vertex);
if (outEdges.length === 0) {
return [ ]; // return an empty list
return [ ]; // return an empty array
}
// sort all outgoing edges according to "when" attribute
@ -683,7 +683,7 @@ To adjust the uniqueness for following edges, there are the following options fo
```
Note that uniqueness checking will have some effect on both runtime and memory usage. For example, when
uniqueness checks are set to *"global"*, lists of visited vertices and edges must be kept in memory while the
uniqueness checks are set to *"global"*, arrays of visited vertices and edges must be kept in memory while the
traversal is executed. Global uniqueness should thus only be used when a traversal is expected to visit
few nodes.
@ -728,7 +728,7 @@ configuration can consist of the following attributes:
(e.g. by pushing vertex data into the result).
- *expander*: expander function that is responsible for returning edges and vertices
directly connected to a vertex . The function signature is *function (config, vertex, path)*.
The expander function is required to return a list of connection objects, consisting of an
The expander function is required to return an array of connection objects, consisting of an
*edge* and *vertex* attribute each.
- *filter*: vertex filter function. The function signature is *function (config, vertex, path)*. It
may return one of the following values:

View File

@ -75,7 +75,7 @@ around in a query.
In previous versions of ArangoDB, AQL queries aborted with an exception in many
situations and threw a runtime exception. Exceptions were thrown when trying to
find a value using the `IN` operator in a non-list element, when trying to use
find a value using the `IN` operator in a non-array element, when trying to use
non-boolean values with the logical operands `&&` or `||` or `!`, when using non-numeric
values in arithmetic operations, when passing wrong parameters into functions etc.
@ -83,7 +83,7 @@ In ArangoDB 2.3 this has been changed in many cases to make AQL more user-friend
and to allow the optimization to perform much more query optimizations.
Here is a summary of changes:
- when a non-list value is used on the right-hand side of the `IN` operator, the
- when a non-array value is used on the right-hand side of the `IN` operator, the
result will be `false` in ArangoDB 2.3, and no exception will be thrown.
- the boolean operators `&&` and `||` do not throw in ArangoDB 2.3 if any of the
operands is not a boolean value. Instead, they will perform an implicit cast of
@ -215,7 +215,7 @@ be returned inside the `stats` attribute of the `extra` attribute, and not direc
as an attribute inside the `extra` attribute as in 2.2. Note that a `fullCount` will
only be present in `extra`.`stats` if it was requested as an option for the query.
The result in ArangoDB 2.3 will also contain a `warnings` attribute with the list of
The result in ArangoDB 2.3 will also contain a `warnings` attribute with the array of
warnings that happened during query execution.
@ -260,17 +260,17 @@ non-deterministic behavior because queries are not executed linearly.
!SUBSECTION Changed return value of `TO_BOOL`
The AQL function `TO_BOOL` now always returns *true* if its argument is a list or a document.
In previous versions of ArangoDB, the function returned *false* for empty lists or for
documents without attributes.
The AQL function `TO_BOOL` now always returns *true* if its argument is a array or an object.
In previous versions of ArangoDB, the function returned *false* for empty arrays or for
objects without attributes.
!SUBSECTION Changed return value of `TO_NUMBER`
The AQL function `TO_NUMBER` now returns *null* if its argument is a document or a
list with more than one member. In previous version of ArangoDB, the return
value in these cases was 0. `TO_NUMBER` will return 0 for empty lists, and the numeric
equivalent of the list member's value for lists with a single member.
The AQL function `TO_NUMBER` now returns *null* if its argument is an object or an
array with more than one member. In previous version of ArangoDB, the return
value in these cases was 0. `TO_NUMBER` will return 0 for empty array, and the numeric
equivalent of the array member's value for arrays with a single member.
!SUBSECTION New AQL keywords

View File

@ -1836,9 +1836,9 @@ AstNode* Ast::optimizeFor (AstNode* node) {
if (expression->isConstant() &&
expression->type != NODE_TYPE_ARRAY) {
// right-hand operand to FOR statement is no list
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_LIST_EXPECTED,
TRI_errno_string(TRI_ERROR_QUERY_LIST_EXPECTED) + std::string(" as operand to FOR loop"));
// right-hand operand to FOR statement is no array
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_ARRAY_EXPECTED,
TRI_errno_string(TRI_ERROR_QUERY_ARRAY_EXPECTED) + std::string(" as operand to FOR loop"));
}
// no real optimizations will be done here

View File

@ -2291,8 +2291,8 @@ AqlValue EnumerateListBlock::getAqlValue (AqlValue inVarReg) {
}
void EnumerateListBlock::throwListExpectedException () {
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_LIST_EXPECTED,
TRI_errno_string(TRI_ERROR_QUERY_LIST_EXPECTED) +
THROW_ARANGO_EXCEPTION_MESSAGE(TRI_ERROR_QUERY_ARRAY_EXPECTED,
TRI_errno_string(TRI_ERROR_QUERY_ARRAY_EXPECTED) +
std::string(" as operand to FOR loop"));
}

View File

@ -85,8 +85,8 @@ std::unordered_map<std::string, Function const> const Executor::FunctionNames{
// n = number
// s = string
// p = primitive
// l = list
// a = (hash) array/document
// l = array
// a = object / document
// r = regex (a string with a special format). note: the regex type is mutually exclusive with all other types
// type check functions
@ -94,13 +94,19 @@ std::unordered_map<std::string, Function const> const Executor::FunctionNames{
{ "IS_BOOL", Function("IS_BOOL", "AQL_IS_BOOL", ".", true, false, true, &Functions::IsBool) },
{ "IS_NUMBER", Function("IS_NUMBER", "AQL_IS_NUMBER", ".", true, false, true, &Functions::IsNumber) },
{ "IS_STRING", Function("IS_STRING", "AQL_IS_STRING", ".", true, false, true, &Functions::IsString) },
{ "IS_LIST", Function("IS_LIST", "AQL_IS_LIST", ".", true, false, true, &Functions::IsList) },
{ "IS_DOCUMENT", Function("IS_DOCUMENT", "AQL_IS_DOCUMENT", ".", true, false, true, &Functions::IsDocument) },
{ "IS_ARRAY", Function("IS_ARRAY", "AQL_IS_ARRAY", ".", true, false, true, &Functions::IsArray) },
// IS_LIST is an alias for IS_ARRAY
{ "IS_LIST", Function("IS_LIST", "AQL_IS_LIST", ".", true, false, true, &Functions::IsArray) },
{ "IS_OBJECT", Function("IS_OBJECT", "AQL_IS_OBJECT", ".", true, false, true, &Functions::IsObject) },
// IS_DOCUMENT is an alias for IS_OBJECT
{ "IS_DOCUMENT", Function("IS_DOCUMENT", "AQL_IS_DOCUMENT", ".", true, false, true, &Functions::IsObject) },
// type cast functions
{ "TO_NUMBER", Function("TO_NUMBER", "AQL_TO_NUMBER", ".", true, false, true) },
{ "TO_STRING", Function("TO_STRING", "AQL_TO_STRING", ".", true, false, true) },
{ "TO_BOOL", Function("TO_BOOL", "AQL_TO_BOOL", ".", true, false, true) },
{ "TO_ARRAY", Function("TO_ARRAY", "AQL_TO_ARRAY", ".", true, false, true) },
// TO_LIST is an alias for TO_ARRAY
{ "TO_LIST", Function("TO_LIST", "AQL_TO_LIST", ".", true, false, true) },
// string functions

View File

@ -79,23 +79,23 @@ AqlValue Functions::IsString (triagens::arango::AqlTransaction* trx,
}
////////////////////////////////////////////////////////////////////////////////
/// @brief function IS_LIST
/// @brief function IS_ARRAY
////////////////////////////////////////////////////////////////////////////////
AqlValue Functions::IsList (triagens::arango::AqlTransaction* trx,
TRI_document_collection_t const* collection,
AqlValue const parameters) {
AqlValue Functions::IsArray (triagens::arango::AqlTransaction* trx,
TRI_document_collection_t const* collection,
AqlValue const parameters) {
Json j(parameters.extractListMember(trx, collection, 0, false));
return AqlValue(new Json(j.isArray()));
}
////////////////////////////////////////////////////////////////////////////////
/// @brief function IS_DOCUMENT
/// @brief function IS_OBJECT
////////////////////////////////////////////////////////////////////////////////
AqlValue Functions::IsDocument (triagens::arango::AqlTransaction* trx,
TRI_document_collection_t const* collection,
AqlValue const parameters) {
AqlValue Functions::IsObject (triagens::arango::AqlTransaction* trx,
TRI_document_collection_t const* collection,
AqlValue const parameters) {
Json j(parameters.extractListMember(trx, collection, 0, false));
return AqlValue(new Json(j.isObject()));
}

View File

@ -47,15 +47,15 @@ namespace triagens {
struct Functions {
////////////////////////////////////////////////////////////////////////////////
/// @brief function IS_NULL
/// @brief functions
////////////////////////////////////////////////////////////////////////////////
static AqlValue IsNull (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsBool (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsNumber (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsString (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsList (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsDocument (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsArray (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue IsObject (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
static AqlValue Length (triagens::arango::AqlTransaction*, TRI_document_collection_t const*, AqlValue const);
};

View File

@ -157,7 +157,7 @@ function get_api_aqlfunction (req, res) {
/// code : "function (celsius) { return celsius * 1.8 + 32; }"
/// };
///
/// var response = logCurlRequest('POST', url, body);
/// var response = logCurlRequest('POST', url, JSON.stringify(body));
///
/// assert(response.code === 201);
///
@ -243,7 +243,7 @@ function post_api_aqlfunction (req, res) {
/// code : "function (x) { return x*x; }"
/// };
///
/// db._connection.POST("/_api/aqlfunction", body);
/// db._connection.POST("/_api/aqlfunction", JSON.stringify(body));
/// var response = logCurlRequest('DELETE', url);
///
/// assert(response.code === 200);

View File

@ -167,7 +167,7 @@
"ERROR_QUERY_INVALID_LOGICAL_VALUE" : { "code" : 1560, "message" : "invalid logical value" },
"ERROR_QUERY_INVALID_ARITHMETIC_VALUE" : { "code" : 1561, "message" : "invalid arithmetic value" },
"ERROR_QUERY_DIVISION_BY_ZERO" : { "code" : 1562, "message" : "division by zero" },
"ERROR_QUERY_LIST_EXPECTED" : { "code" : 1563, "message" : "list expected" },
"ERROR_QUERY_ARRAY_EXPECTED" : { "code" : 1563, "message" : "array expected" },
"ERROR_QUERY_FAIL_CALLED" : { "code" : 1569, "message" : "FAIL(%s) called" },
"ERROR_QUERY_GEO_INDEX_MISSING" : { "code" : 1570, "message" : "no suitable geo index found for geo restriction on '%s'" },
"ERROR_QUERY_FULLTEXT_INDEX_MISSING" : { "code" : 1571, "message" : "no suitable fulltext index found for fulltext query on '%s'" },

View File

@ -167,7 +167,7 @@
"ERROR_QUERY_INVALID_LOGICAL_VALUE" : { "code" : 1560, "message" : "invalid logical value" },
"ERROR_QUERY_INVALID_ARITHMETIC_VALUE" : { "code" : 1561, "message" : "invalid arithmetic value" },
"ERROR_QUERY_DIVISION_BY_ZERO" : { "code" : 1562, "message" : "division by zero" },
"ERROR_QUERY_LIST_EXPECTED" : { "code" : 1563, "message" : "list expected" },
"ERROR_QUERY_ARRAY_EXPECTED" : { "code" : 1563, "message" : "array expected" },
"ERROR_QUERY_FAIL_CALLED" : { "code" : 1569, "message" : "FAIL(%s) called" },
"ERROR_QUERY_GEO_INDEX_MISSING" : { "code" : 1570, "message" : "no suitable geo index found for geo restriction on '%s'" },
"ERROR_QUERY_FULLTEXT_INDEX_MISSING" : { "code" : 1571, "message" : "no suitable fulltext index found for fulltext query on '%s'" },

View File

@ -59,8 +59,8 @@ var TYPEWEIGHT_NULL = 0;
var TYPEWEIGHT_BOOL = 1;
var TYPEWEIGHT_NUMBER = 2;
var TYPEWEIGHT_STRING = 4;
var TYPEWEIGHT_LIST = 8;
var TYPEWEIGHT_DOCUMENT = 16;
var TYPEWEIGHT_ARRAY = 8;
var TYPEWEIGHT_OBJECT = 16;
// -----------------------------------------------------------------------------
// --SECTION-- helper functions
@ -393,7 +393,7 @@ function TYPEWEIGHT (value) {
if (value !== undefined && value !== null) {
if (Array.isArray(value)) {
return TYPEWEIGHT_LIST;
return TYPEWEIGHT_ARRAY;
}
switch (typeof(value)) {
@ -408,7 +408,7 @@ function TYPEWEIGHT (value) {
case 'string':
return TYPEWEIGHT_STRING;
case 'object':
return TYPEWEIGHT_DOCUMENT;
return TYPEWEIGHT_OBJECT;
}
}
@ -602,7 +602,7 @@ function FCALL_DYNAMIC (func, applyDirect, values, name, args) {
var type = TYPEWEIGHT(values), result, i;
if (type === TYPEWEIGHT_DOCUMENT) {
if (type === TYPEWEIGHT_OBJECT) {
result = { };
for (i in values) {
if (values.hasOwnProperty(i)) {
@ -612,7 +612,7 @@ function FCALL_DYNAMIC (func, applyDirect, values, name, args) {
}
return result;
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
result = [ ];
for (i = 0; i < values.length; ++i) {
args[0] = values[i];
@ -770,10 +770,10 @@ function GET_INDEX (value, index) {
}
var result = null;
if (TYPEWEIGHT(value) === TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(value) === TYPEWEIGHT_OBJECT) {
result = value[String(index)];
}
else if (TYPEWEIGHT(value) === TYPEWEIGHT_LIST) {
else if (TYPEWEIGHT(value) === TYPEWEIGHT_ARRAY) {
var i = parseInt(index, 10);
if (i < 0) {
// negative indexes fetch the element from the end, e.g. -1 => value[value.length - 1];
@ -835,7 +835,7 @@ function NORMALIZE (value) {
function DOCUMENT_MEMBER (value, attributeName) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(value) !== TYPEWEIGHT_OBJECT) {
return null;
}
@ -855,7 +855,7 @@ function DOCUMENT_MEMBER (value, attributeName) {
function DOCUMENT_HANDLE (id) {
"use strict";
if (TYPEWEIGHT(id) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(id) === TYPEWEIGHT_ARRAY) {
var result = [ ], i;
for (i = 0; i < id.length; ++i) {
try {
@ -887,12 +887,12 @@ function AQL_DOCUMENT (collection, id) {
// called with a single parameter
var weight = TYPEWEIGHT(collection);
if (weight === TYPEWEIGHT_STRING || weight === TYPEWEIGHT_LIST) {
if (weight === TYPEWEIGHT_STRING || weight === TYPEWEIGHT_ARRAY) {
return DOCUMENT_HANDLE(collection);
}
}
if (TYPEWEIGHT(id) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(id) === TYPEWEIGHT_ARRAY) {
var c = COLLECTION(collection);
var result = [ ], i;
@ -1048,7 +1048,7 @@ function RELATIONAL_EQUAL (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1090,7 +1090,7 @@ function RELATIONAL_UNEQUAL (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1134,7 +1134,7 @@ function RELATIONAL_GREATER_REC (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1200,7 +1200,7 @@ function RELATIONAL_GREATEREQUAL_REC (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1266,7 +1266,7 @@ function RELATIONAL_LESS_REC (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1332,7 +1332,7 @@ function RELATIONAL_LESSEQUAL_REC (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1401,7 +1401,7 @@ function RELATIONAL_CMP (lhs, rhs) {
// lhs and rhs have the same type
if (leftWeight >= TYPEWEIGHT_LIST) {
if (leftWeight >= TYPEWEIGHT_ARRAY) {
// arrays and objects
var keys = KEYLIST(lhs, rhs), i, n = keys.length;
for (i = 0; i < n; ++i) {
@ -1445,8 +1445,8 @@ function RELATIONAL_IN (lhs, rhs) {
var rightWeight = TYPEWEIGHT(rhs);
if (rightWeight !== TYPEWEIGHT_LIST) {
WARN(null, INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (rightWeight !== TYPEWEIGHT_ARRAY) {
WARN(null, INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return false;
}
@ -1626,7 +1626,7 @@ function AQL_CONCAT () {
if (weight === TYPEWEIGHT_NULL) {
continue;
}
else if (weight === TYPEWEIGHT_LIST) {
else if (weight === TYPEWEIGHT_ARRAY) {
for (j = 0; j < element.length; ++j) {
if (TYPEWEIGHT(element[j]) !== TYPEWEIGHT_NULL) {
result += AQL_TO_STRING(element[j]);
@ -1666,7 +1666,7 @@ function AQL_CONCAT_SEPARATOR () {
result += separator;
}
if (weight === TYPEWEIGHT_LIST) {
if (weight === TYPEWEIGHT_ARRAY) {
found = false;
for (j = 0; j < element.length; ++j) {
if (TYPEWEIGHT(element[j]) !== TYPEWEIGHT_NULL) {
@ -1888,7 +1888,7 @@ function AQL_SPLIT (value, separator, limit) {
return null;
}
if (TYPEWEIGHT(separator) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(separator) === TYPEWEIGHT_ARRAY) {
var patterns = [];
separator.forEach(function(s) {
patterns.push(CREATE_REGEX_PATTERN(AQL_TO_STRING(s)));
@ -1910,7 +1910,7 @@ function AQL_SUBSTITUTE (value, search, replace, limit) {
var pattern, patterns, replacements = { }, sWeight = TYPEWEIGHT(search);
value = AQL_TO_STRING(value);
if (sWeight === TYPEWEIGHT_DOCUMENT) {
if (sWeight === TYPEWEIGHT_OBJECT) {
patterns = [ ];
KEYS(search, false).forEach(function(k) {
patterns.push(CREATE_REGEX_PATTERN(k));
@ -1928,7 +1928,7 @@ function AQL_SUBSTITUTE (value, search, replace, limit) {
replacements[search] = AQL_TO_STRING(replace);
}
}
else if (sWeight === TYPEWEIGHT_LIST) {
else if (sWeight === TYPEWEIGHT_ARRAY) {
if (search.length === 0) {
// empty list
WARN("SUBSTITUTE", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
@ -1937,7 +1937,7 @@ function AQL_SUBSTITUTE (value, search, replace, limit) {
patterns = [ ];
if (TYPEWEIGHT(replace) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(replace) === TYPEWEIGHT_ARRAY) {
// replace each occurrence with a member from the second list
search.forEach(function(k, i) {
k = AQL_TO_STRING(k);
@ -2089,8 +2089,8 @@ function AQL_TO_BOOL (value) {
return (value !== 0);
case TYPEWEIGHT_STRING:
return (value !== '');
case TYPEWEIGHT_LIST:
case TYPEWEIGHT_DOCUMENT:
case TYPEWEIGHT_ARRAY:
case TYPEWEIGHT_OBJECT:
return true;
}
}
@ -2122,7 +2122,7 @@ function AQL_TO_NUMBER (value) {
case TYPEWEIGHT_STRING:
var result = NUMERIC_VALUE(Number(value));
return ((TYPEWEIGHT(result) === TYPEWEIGHT_NUMBER) ? result : null);
case TYPEWEIGHT_LIST:
case TYPEWEIGHT_ARRAY:
if (value.length === 0) {
return 0;
}
@ -2151,19 +2151,19 @@ function AQL_TO_STRING (value) {
case TYPEWEIGHT_STRING:
return value;
case TYPEWEIGHT_NUMBER:
case TYPEWEIGHT_LIST:
case TYPEWEIGHT_DOCUMENT:
case TYPEWEIGHT_ARRAY:
case TYPEWEIGHT_OBJECT:
return value.toString();
}
}
////////////////////////////////////////////////////////////////////////////////
/// @brief cast to a list
/// @brief cast to an array
///
/// the operand can have any type, always returns a list
////////////////////////////////////////////////////////////////////////////////
function AQL_TO_LIST (value) {
function AQL_TO_ARRAY (value) {
"use strict";
switch (TYPEWEIGHT(value)) {
@ -2173,9 +2173,9 @@ function AQL_TO_LIST (value) {
case TYPEWEIGHT_NUMBER:
case TYPEWEIGHT_STRING:
return [ value ];
case TYPEWEIGHT_LIST:
case TYPEWEIGHT_ARRAY:
return value;
case TYPEWEIGHT_DOCUMENT:
case TYPEWEIGHT_OBJECT:
return VALUES(value);
}
}
@ -2233,27 +2233,27 @@ function AQL_IS_STRING (value) {
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if value is of type list
/// @brief test if value is of type array
///
/// returns a bool
////////////////////////////////////////////////////////////////////////////////
function AQL_IS_LIST (value) {
function AQL_IS_ARRAY (value) {
"use strict";
return (TYPEWEIGHT(value) === TYPEWEIGHT_LIST);
return (TYPEWEIGHT(value) === TYPEWEIGHT_ARRAY);
}
////////////////////////////////////////////////////////////////////////////////
/// @brief test if value is of type document
/// @brief test if value is of type object
///
/// returns a bool
////////////////////////////////////////////////////////////////////////////////
function AQL_IS_DOCUMENT (value) {
function AQL_IS_OBJECT (value) {
"use strict";
return (TYPEWEIGHT(value) === TYPEWEIGHT_DOCUMENT);
return (TYPEWEIGHT(value) === TYPEWEIGHT_OBJECT);
}
// -----------------------------------------------------------------------------
@ -2333,10 +2333,10 @@ function AQL_LENGTH (value) {
var result, typeWeight = TYPEWEIGHT(value);
if (typeWeight === TYPEWEIGHT_LIST) {
if (typeWeight === TYPEWEIGHT_ARRAY) {
return value.length;
}
else if (typeWeight === TYPEWEIGHT_DOCUMENT) {
else if (typeWeight === TYPEWEIGHT_OBJECT) {
return KEYS(value, false).length;
}
@ -2350,8 +2350,8 @@ function AQL_LENGTH (value) {
function AQL_FIRST (value) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
WARN("FIRST", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(value) !== TYPEWEIGHT_ARRAY) {
WARN("FIRST", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2369,8 +2369,8 @@ function AQL_FIRST (value) {
function AQL_LAST (value) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
WARN("LAST", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(value) !== TYPEWEIGHT_ARRAY) {
WARN("LAST", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2388,8 +2388,8 @@ function AQL_LAST (value) {
function AQL_POSITION (value, search, returnIndex) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
WARN("POSITION", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(value) !== TYPEWEIGHT_ARRAY) {
WARN("POSITION", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2415,8 +2415,8 @@ function AQL_POSITION (value, search, returnIndex) {
function AQL_NTH (value, position) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
WARN("NTH", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(value) !== TYPEWEIGHT_ARRAY) {
WARN("NTH", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2439,11 +2439,11 @@ function AQL_REVERSE (value) {
return value.split("").reverse().join("");
}
if (TYPEWEIGHT(value) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(value) === TYPEWEIGHT_ARRAY) {
return CLONE(value).reverse();
}
WARN("REVERSE", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
WARN("REVERSE", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2504,8 +2504,8 @@ function AQL_RANGE (from, to, step) {
function AQL_UNIQUE (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("UNIQUE", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("UNIQUE", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -2540,7 +2540,7 @@ function AQL_UNION () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_ARRAY) {
WARN("UNION", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -2569,7 +2569,7 @@ function AQL_UNION_DISTINCT () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_ARRAY) {
WARN("UNION_DISTINCT", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -2666,7 +2666,7 @@ function AQL_REMOVE_VALUES (list, values) {
if (type === TYPEWEIGHT_NULL) {
return list;
}
else if (type !== TYPEWEIGHT_LIST) {
else if (type !== TYPEWEIGHT_ARRAY) {
WARN("REMOVE_VALUES", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -2675,7 +2675,7 @@ function AQL_REMOVE_VALUES (list, values) {
if (type === TYPEWEIGHT_NULL) {
return [ ];
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
var copy = [ ], i;
for (i = 0; i < list.length; ++i) {
if (RELATIONAL_IN(list[i], values)) {
@ -2701,7 +2701,7 @@ function AQL_REMOVE_VALUE (list, value, limit) {
if (type === TYPEWEIGHT_NULL) {
return [ ];
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
if (TYPEWEIGHT(limit) === TYPEWEIGHT_NULL) {
limit = -1;
}
@ -2735,7 +2735,7 @@ function AQL_REMOVE_NTH (list, position) {
if (type === TYPEWEIGHT_NULL) {
return [ ];
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
position = AQL_TO_NUMBER(position);
if (position >= list.length || position < - list.length) {
return list;
@ -2771,7 +2771,7 @@ function AQL_PUSH (list, value, unique) {
if (type === TYPEWEIGHT_NULL) {
return [ value ];
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
if (AQL_TO_BOOL(unique)) {
if (RELATIONAL_IN(value, list)) {
return list;
@ -2798,7 +2798,7 @@ function AQL_APPEND (list, values, unique) {
if (type === TYPEWEIGHT_NULL) {
return list;
}
else if (type !== TYPEWEIGHT_LIST) {
else if (type !== TYPEWEIGHT_ARRAY) {
values = [ values ];
}
@ -2816,7 +2816,7 @@ function AQL_APPEND (list, values, unique) {
if (type === TYPEWEIGHT_NULL) {
return values;
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
var copy = CLONE(list);
if (unique) {
var i;
@ -2846,7 +2846,7 @@ function AQL_POP (list) {
if (type === TYPEWEIGHT_NULL) {
return null;
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
if (list.length === 0) {
return [ ];
}
@ -2871,7 +2871,7 @@ function AQL_UNSHIFT (list, value, unique) {
if (type === TYPEWEIGHT_NULL) {
return [ value ];
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
if (unique) {
if (RELATIONAL_IN(value, list)) {
return list;
@ -2897,7 +2897,7 @@ function AQL_SHIFT (list) {
if (type === TYPEWEIGHT_NULL) {
return null;
}
else if (type === TYPEWEIGHT_LIST) {
else if (type === TYPEWEIGHT_ARRAY) {
if (list.length === 0) {
return [ ];
}
@ -2918,7 +2918,7 @@ function AQL_SHIFT (list) {
function AQL_SLICE (value, from, to) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(value) !== TYPEWEIGHT_ARRAY) {
WARN("SLICE", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -2951,7 +2951,7 @@ function AQL_MINUS () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_ARRAY) {
WARN("MINUS", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3003,7 +3003,7 @@ function AQL_INTERSECTION () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_ARRAY) {
WARN("INTERSECTION", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3043,8 +3043,8 @@ function AQL_INTERSECTION () {
function AQL_FLATTEN (values, maxDepth, depth) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("FLATTEN", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("FLATTEN", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3065,7 +3065,7 @@ function AQL_FLATTEN (values, maxDepth, depth) {
for (i = 0, n = values.length; i < n; ++i) {
value = values[i];
if (depth < maxDepth && TYPEWEIGHT(value) === TYPEWEIGHT_LIST) {
if (depth < maxDepth && TYPEWEIGHT(value) === TYPEWEIGHT_ARRAY) {
AQL_FLATTEN(value, maxDepth, depth + 1).forEach(p);
}
else {
@ -3083,8 +3083,8 @@ function AQL_FLATTEN (values, maxDepth, depth) {
function AQL_MAX (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("MAX", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("MAX", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3110,8 +3110,8 @@ function AQL_MAX (values) {
function AQL_MIN (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("MIN", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("MIN", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3137,8 +3137,8 @@ function AQL_MIN (values) {
function AQL_SUM (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("SUM", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("SUM", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3168,8 +3168,8 @@ function AQL_SUM (values) {
function AQL_AVERAGE (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("AVERAGE", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("AVERAGE", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3205,8 +3205,8 @@ function AQL_AVERAGE (values) {
function AQL_MEDIAN (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("MEDIAN", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("MEDIAN", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3248,8 +3248,8 @@ function AQL_MEDIAN (values) {
function AQL_PERCENTILE (values, p, method) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("PERCENTILE", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("PERCENTILE", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3329,8 +3329,8 @@ function AQL_PERCENTILE (values, p, method) {
function VARIANCE (values) {
"use strict";
if (TYPEWEIGHT(values) !== TYPEWEIGHT_LIST) {
WARN("VARIANCE", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY) {
WARN("VARIANCE", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -3556,13 +3556,13 @@ function AQL_WITHIN_RECTANGLE (collection, latitude1, longitude1, latitude2, lon
function AQL_IS_IN_POLYGON (points, latitude, longitude) {
"use strict";
if (TYPEWEIGHT(points) !== TYPEWEIGHT_LIST) {
WARN("POINT_IN_POLYGON", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(points) !== TYPEWEIGHT_ARRAY) {
WARN("POINT_IN_POLYGON", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return false;
}
var searchLat, searchLon, pointLat, pointLon, geoJson = false;
if (TYPEWEIGHT(latitude) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(latitude) === TYPEWEIGHT_ARRAY) {
geoJson = AQL_TO_BOOL(longitude);
if (geoJson) {
// first list value is longitude, then latitude
@ -3595,7 +3595,7 @@ function AQL_IS_IN_POLYGON (points, latitude, longitude) {
var oddNodes = false;
for (i = 0; i < points.length; ++i) {
if (TYPEWEIGHT(points[i]) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(points[i]) !== TYPEWEIGHT_ARRAY) {
continue;
}
@ -3686,7 +3686,7 @@ function AQL_FIRST_LIST () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) === TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(element) === TYPEWEIGHT_ARRAY) {
return element;
}
}
@ -3711,7 +3711,7 @@ function AQL_FIRST_DOCUMENT () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) === TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) === TYPEWEIGHT_OBJECT) {
return element;
}
}
@ -3740,7 +3740,7 @@ function AQL_PARSE_IDENTIFIER (value) {
}
// fall through intentional
}
else if (TYPEWEIGHT(value) === TYPEWEIGHT_DOCUMENT) {
else if (TYPEWEIGHT(value) === TYPEWEIGHT_OBJECT) {
if (value.hasOwnProperty('_id')) {
return AQL_PARSE_IDENTIFIER(value._id);
}
@ -3813,7 +3813,7 @@ function AQL_HAS (element, name) {
return false;
}
if (weight !== TYPEWEIGHT_DOCUMENT) {
if (weight !== TYPEWEIGHT_OBJECT) {
return false;
}
@ -3827,7 +3827,7 @@ function AQL_HAS (element, name) {
function AQL_ATTRIBUTES (element, removeInternal, sort) {
"use strict";
if (TYPEWEIGHT(element) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_OBJECT) {
WARN("ATTRIBUTES", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3858,7 +3858,7 @@ function AQL_ATTRIBUTES (element, removeInternal, sort) {
function AQL_VALUES (element, removeInternal) {
"use strict";
if (TYPEWEIGHT(element) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_OBJECT) {
WARN("VALUES", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3883,8 +3883,8 @@ function AQL_VALUES (element, removeInternal) {
function AQL_ZIP (keys, values) {
"use strict";
if (TYPEWEIGHT(keys) !== TYPEWEIGHT_LIST ||
TYPEWEIGHT(values) !== TYPEWEIGHT_LIST ||
if (TYPEWEIGHT(keys) !== TYPEWEIGHT_ARRAY ||
TYPEWEIGHT(values) !== TYPEWEIGHT_ARRAY ||
keys.length !== values.length) {
WARN("ZIP", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
@ -3906,7 +3906,7 @@ function AQL_ZIP (keys, values) {
function AQL_UNSET (value) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(value) !== TYPEWEIGHT_OBJECT) {
WARN("UNSET", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3930,7 +3930,7 @@ function AQL_UNSET (value) {
function AQL_KEEP (value) {
"use strict";
if (TYPEWEIGHT(value) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(value) !== TYPEWEIGHT_OBJECT) {
WARN("KEEP", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3966,7 +3966,7 @@ function AQL_MERGE () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_OBJECT) {
WARN("MERGE", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -3992,7 +3992,7 @@ function AQL_MERGE_RECURSIVE () {
var r = CLONE(old);
Object.keys(element).forEach(function(k) {
if (r.hasOwnProperty(k) && TYPEWEIGHT(element[k]) === TYPEWEIGHT_DOCUMENT) {
if (r.hasOwnProperty(k) && TYPEWEIGHT(element[k]) === TYPEWEIGHT_OBJECT) {
r[k] = recurse(r[k], element[k]);
}
else {
@ -4007,7 +4007,7 @@ function AQL_MERGE_RECURSIVE () {
if (arguments.hasOwnProperty(i)) {
var element = arguments[i];
if (TYPEWEIGHT(element) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_OBJECT) {
WARN("MERGE_RECURSIVE", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -4026,7 +4026,7 @@ function AQL_MERGE_RECURSIVE () {
function AQL_TRANSLATE (value, lookup, defaultValue) {
"use strict";
if (TYPEWEIGHT(lookup) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(lookup) !== TYPEWEIGHT_OBJECT) {
WARN("TRANSLATE", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return null;
}
@ -4052,7 +4052,7 @@ function AQL_TRANSLATE (value, lookup, defaultValue) {
function AQL_MATCHES (element, examples, returnIndex) {
"use strict";
if (TYPEWEIGHT(element) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(element) !== TYPEWEIGHT_OBJECT) {
return false;
}
@ -4069,7 +4069,7 @@ function AQL_MATCHES (element, examples, returnIndex) {
for (i = 0; i < examples.length; ++i) {
var example = examples[i];
var result = true;
if (TYPEWEIGHT(example) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(example) !== TYPEWEIGHT_OBJECT) {
WARN("MATCHES", INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
continue;
}
@ -4541,8 +4541,8 @@ function AQL_PATHS (vertices, edgeCollection, direction, followCycles, minLength
minLength = minLength || 0;
maxLength = maxLength !== undefined ? maxLength : 10;
if (TYPEWEIGHT(vertices) !== TYPEWEIGHT_LIST) {
WARN("PATHS", INTERNAL.errors.ERROR_QUERY_LIST_EXPECTED);
if (TYPEWEIGHT(vertices) !== TYPEWEIGHT_ARRAY) {
WARN("PATHS", INTERNAL.errors.ERROR_QUERY_ARRAY_EXPECTED);
return null;
}
@ -4849,7 +4849,7 @@ function TRAVERSAL_CHECK_EXAMPLES_TYPEWEIGHTS (examples, func) {
return true;
}
if (TYPEWEIGHT(examples) !== TYPEWEIGHT_LIST) {
if (TYPEWEIGHT(examples) !== TYPEWEIGHT_ARRAY) {
WARN(func, INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return false;
}
@ -4860,7 +4860,7 @@ function TRAVERSAL_CHECK_EXAMPLES_TYPEWEIGHTS (examples, func) {
var i;
for (i = 0; i < examples.length; ++i) {
if (TYPEWEIGHT(examples[i]) !== TYPEWEIGHT_DOCUMENT) {
if (TYPEWEIGHT(examples[i]) !== TYPEWEIGHT_OBJECT) {
WARN(func, INTERNAL.errors.ERROR_QUERY_FUNCTION_ARGUMENT_TYPE_MISMATCH);
return false;
}
@ -7510,13 +7510,16 @@ exports.AQL_FIND_LAST = AQL_FIND_LAST;
exports.AQL_TO_BOOL = AQL_TO_BOOL;
exports.AQL_TO_NUMBER = AQL_TO_NUMBER;
exports.AQL_TO_STRING = AQL_TO_STRING;
exports.AQL_TO_LIST = AQL_TO_LIST;
exports.AQL_TO_ARRAY = AQL_TO_ARRAY;
exports.AQL_TO_LIST = AQL_TO_ARRAY; // alias
exports.AQL_IS_NULL = AQL_IS_NULL;
exports.AQL_IS_BOOL = AQL_IS_BOOL;
exports.AQL_IS_NUMBER = AQL_IS_NUMBER;
exports.AQL_IS_STRING = AQL_IS_STRING;
exports.AQL_IS_LIST = AQL_IS_LIST;
exports.AQL_IS_DOCUMENT = AQL_IS_DOCUMENT;
exports.AQL_IS_ARRAY = AQL_IS_ARRAY;
exports.AQL_IS_LIST = AQL_IS_ARRAY; // alias
exports.AQL_IS_OBJECT = AQL_IS_OBJECT;
exports.AQL_IS_DOCUMENT = AQL_IS_OBJECT; // alias
exports.AQL_FLOOR = AQL_FLOOR;
exports.AQL_CEIL = AQL_CEIL;
exports.AQL_ROUND = AQL_ROUND;

View File

@ -753,6 +753,126 @@ function ahuacatlTypesFunctionsTestSuite () {
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray1 : function () {
var expected = [ [ ] ];
var actual = getQueryResults("RETURN TO_ARRAY(null)");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray2 : function () {
var expected = [ [ false ] ];
var actual = getQueryResults("RETURN TO_ARRAY(false)");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray3 : function () {
var expected = [ [ true ] ];
var actual = getQueryResults("RETURN TO_ARRAY(true)");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray4 : function () {
var expected = [ [ 35 ] ];
var actual = getQueryResults("RETURN TO_ARRAY(35)");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray5 : function () {
var expected = [ [ -0.635 ] ];
var actual = getQueryResults("RETURN TO_ARRAY(-0.635)");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray6 : function () {
var expected = [ [ "" ] ];
var actual = getQueryResults("RETURN TO_ARRAY(\"\")");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray7 : function () {
var expected = [ [ "value" ] ];
var actual = getQueryResults("RETURN TO_ARRAY(\"value\")");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray8 : function () {
var expected = [ [ ] ];
var actual = getQueryResults("RETURN TO_ARRAY({ })");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray9 : function () {
var expected = [ [ 0 ] ];
var actual = getQueryResults("RETURN TO_ARRAY({ \"a\" : 0 })");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray10 : function () {
var expected = [ [ null, -63, [ 1, 2 ], { "a" : "b" } ] ];
var actual = getQueryResults("RETURN TO_ARRAY({ \"a\" : null, \"b\" : -63, \"c\" : [ 1, 2 ], \"d\": { \"a\" : \"b\" } })");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray11 : function () {
var expected = [ [ ] ];
var actual = getQueryResults("RETURN TO_ARRAY([ ])");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_array
////////////////////////////////////////////////////////////////////////////////
testToArray12 : function () {
var expected = [ [ 0, null, -1 ] ];
var actual = getQueryResults("RETURN TO_ARRAY([ 0, null, -1 ])");
assertEqual(expected, actual);
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test to_list
////////////////////////////////////////////////////////////////////////////////

View File

@ -103,11 +103,11 @@ function ahuacatlFunctionsTestSuite () {
testFirstInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN FIRST()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN FIRST([ ], [ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FIRST(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FIRST(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FIRST(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FIRST(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FIRST({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FIRST(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FIRST(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FIRST(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FIRST(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FIRST({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -157,11 +157,11 @@ function ahuacatlFunctionsTestSuite () {
testLastInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN LAST()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN LAST([ ], [ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN LAST(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN LAST(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN LAST(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN LAST(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN LAST({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN LAST(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN LAST(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN LAST(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN LAST(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN LAST({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -228,11 +228,11 @@ function ahuacatlFunctionsTestSuite () {
testPositionInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN POSITION()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN POSITION([ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN POSITION(null, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN POSITION(true, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN POSITION(4, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN POSITION(\"yes\", 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN POSITION({ }, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN POSITION(null, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN POSITION(true, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN POSITION(4, 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN POSITION(\"yes\", 'foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN POSITION({ }, 'foo')");
},
////////////////////////////////////////////////////////////////////////////////
@ -291,11 +291,11 @@ function ahuacatlFunctionsTestSuite () {
testNthInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN NTH()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN NTH([ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN NTH(null, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN NTH(true, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN NTH(4, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN NTH(\"yes\", 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN NTH({ }, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN NTH(null, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN NTH(true, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN NTH(4, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN NTH(\"yes\", 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN NTH({ }, 1)");
assertEqual([ null ], getQueryResults("RETURN NTH([ ], null)"));
assertEqual([ null ], getQueryResults("RETURN NTH([ ], false)"));
assertEqual([ null ], getQueryResults("RETURN NTH([ ], true)"));
@ -362,10 +362,10 @@ function ahuacatlFunctionsTestSuite () {
testReverseInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN REVERSE()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN REVERSE([ ], [ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN REVERSE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN REVERSE(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN REVERSE(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN REVERSE({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN REVERSE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN REVERSE(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN REVERSE(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN REVERSE({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -426,11 +426,11 @@ function ahuacatlFunctionsTestSuite () {
testUniqueInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN UNIQUE()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN UNIQUE([ ], [ ])");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN UNIQUE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN UNIQUE(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN UNIQUE(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN UNIQUE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN UNIQUE({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN UNIQUE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN UNIQUE(true)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN UNIQUE(4)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN UNIQUE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN UNIQUE({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1409,14 +1409,14 @@ function ahuacatlFunctionsTestSuite () {
testFlattenInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN FLATTEN()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN FLATTEN([ ], 1, 1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN(1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN(1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN('foo')");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN(1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN(1)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN('foo')");
assertEqual([ [ ] ], getQueryResults("RETURN FLATTEN([ ], 'foo')"));
assertEqual([ [ ] ], getQueryResults("RETURN FLATTEN([ ], [ ])"));
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN FLATTEN({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN FLATTEN({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1616,11 +1616,11 @@ function ahuacatlFunctionsTestSuite () {
testMinInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MIN()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MIN([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MIN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MIN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MIN(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MIN(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MIN({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MIN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MIN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MIN(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MIN(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MIN({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1660,11 +1660,11 @@ function ahuacatlFunctionsTestSuite () {
testMaxInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MAX()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MAX([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MAX(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MAX(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MAX(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MAX(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MAX({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MAX(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MAX(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MAX(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MAX(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MAX({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1701,11 +1701,11 @@ function ahuacatlFunctionsTestSuite () {
testSumInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SUM()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN SUM([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN SUM(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN SUM(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN SUM(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN SUM(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN SUM({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN SUM(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN SUM(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN SUM(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN SUM(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN SUM({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1748,11 +1748,11 @@ function ahuacatlFunctionsTestSuite () {
testAverageInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN AVERAGE()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN AVERAGE([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN AVERAGE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN AVERAGE(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN AVERAGE(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN AVERAGE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN AVERAGE({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN AVERAGE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN AVERAGE(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN AVERAGE(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN AVERAGE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN AVERAGE({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -1806,11 +1806,11 @@ function ahuacatlFunctionsTestSuite () {
testMedianInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MEDIAN()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN MEDIAN([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MEDIAN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MEDIAN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MEDIAN(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MEDIAN(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN MEDIAN({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MEDIAN(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MEDIAN(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MEDIAN(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MEDIAN(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN MEDIAN({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -2186,11 +2186,11 @@ function ahuacatlFunctionsTestSuite () {
testVariancePopulationInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN VARIANCE_POPULATION()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN VARIANCE_POPULATION([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_POPULATION(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_POPULATION(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_POPULATION(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_POPULATION(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_POPULATION({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_POPULATION(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_POPULATION(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_POPULATION(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_POPULATION(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_POPULATION({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -2243,11 +2243,11 @@ function ahuacatlFunctionsTestSuite () {
testVarianceSampleInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN VARIANCE_SAMPLE()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN VARIANCE_SAMPLE([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_SAMPLE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_SAMPLE(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_SAMPLE(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_SAMPLE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN VARIANCE_SAMPLE({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_SAMPLE(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_SAMPLE(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_SAMPLE(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_SAMPLE(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN VARIANCE_SAMPLE({ })");
},
////////////////////////////////////////////////////////////////////////////////
@ -2305,11 +2305,11 @@ function ahuacatlFunctionsTestSuite () {
testStddevPopulationInvalid : function () {
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN STDDEV_POPULATION()");
assertQueryError(errors.ERROR_QUERY_FUNCTION_ARGUMENT_NUMBER_MISMATCH.code, "RETURN STDDEV_POPULATION([ ], 2)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN STDDEV_POPULATION(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN STDDEV_POPULATION(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN STDDEV_POPULATION(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN STDDEV_POPULATION(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_LIST_EXPECTED.code, "RETURN STDDEV_POPULATION({ })");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN STDDEV_POPULATION(null)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN STDDEV_POPULATION(false)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN STDDEV_POPULATION(3)");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN STDDEV_POPULATION(\"yes\")");
assertQueryWarningAndNull(errors.ERROR_QUERY_ARRAY_EXPECTED.code, "RETURN STDDEV_POPULATION({ })");
},
////////////////////////////////////////////////////////////////////////////////

View File

@ -267,7 +267,7 @@ function ahuacatlOperatorsTestSuite () {
/// @brief test aql.IS_LIST function
////////////////////////////////////////////////////////////////////////////////
testIsArrayTrue : function () {
testIsListTrue : function () {
assertTrue(aql.AQL_IS_LIST([ ]));
assertTrue(aql.AQL_IS_LIST([ 0 ]));
assertTrue(aql.AQL_IS_LIST([ 0, 1 ]));
@ -283,7 +283,7 @@ function ahuacatlOperatorsTestSuite () {
/// @brief test aql.IS_LIST function
////////////////////////////////////////////////////////////////////////////////
testIsArrayFalse : function () {
testIsListFalse : function () {
assertFalse(aql.AQL_IS_LIST('abc'));
assertFalse(aql.AQL_IS_LIST('null'));
assertFalse(aql.AQL_IS_LIST('false'));
@ -307,11 +307,56 @@ function ahuacatlOperatorsTestSuite () {
assertFalse(aql.AQL_IS_LIST({ 'a' : 0, 'b' : 1 }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.IS_ARRAY function
////////////////////////////////////////////////////////////////////////////////
testIsArrayTrue : function () {
assertTrue(aql.AQL_IS_ARRAY([ ]));
assertTrue(aql.AQL_IS_ARRAY([ 0 ]));
assertTrue(aql.AQL_IS_ARRAY([ 0, 1 ]));
assertTrue(aql.AQL_IS_ARRAY([ 1, 2 ]));
assertTrue(aql.AQL_IS_ARRAY([ '' ]));
assertTrue(aql.AQL_IS_ARRAY([ '0' ]));
assertTrue(aql.AQL_IS_ARRAY([ '1' ]));
assertTrue(aql.AQL_IS_ARRAY([ true ]));
assertTrue(aql.AQL_IS_ARRAY([ false ]));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.IS_ARRAY function
////////////////////////////////////////////////////////////////////////////////
testIsArrayFalse : function () {
assertFalse(aql.AQL_IS_ARRAY('abc'));
assertFalse(aql.AQL_IS_ARRAY('null'));
assertFalse(aql.AQL_IS_ARRAY('false'));
assertFalse(aql.AQL_IS_ARRAY('undefined'));
assertFalse(aql.AQL_IS_ARRAY(''));
assertFalse(aql.AQL_IS_ARRAY(' '));
assertFalse(aql.AQL_IS_ARRAY(false));
assertFalse(aql.AQL_IS_ARRAY(true));
assertFalse(aql.AQL_IS_ARRAY(undefined));
assertFalse(aql.AQL_IS_ARRAY(NaN));
assertFalse(aql.AQL_IS_ARRAY(1.3e308 * 1.3e308));
assertFalse(aql.AQL_IS_ARRAY(0));
assertFalse(aql.AQL_IS_ARRAY(1));
assertFalse(aql.AQL_IS_ARRAY(-1));
assertFalse(aql.AQL_IS_ARRAY(0.1));
assertFalse(aql.AQL_IS_ARRAY(-0.1));
assertFalse(aql.AQL_IS_ARRAY(null));
assertFalse(aql.AQL_IS_ARRAY({ }));
assertFalse(aql.AQL_IS_ARRAY({ 'a' : 0 }));
assertFalse(aql.AQL_IS_ARRAY({ 'a' : 1 }));
assertFalse(aql.AQL_IS_ARRAY({ 'a' : 0, 'b' : 1 }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.IS_DOCUMENT function
////////////////////////////////////////////////////////////////////////////////
testIsObjectTrue : function () {
testIsDocumentTrue : function () {
assertTrue(aql.AQL_IS_DOCUMENT({ }));
assertTrue(aql.AQL_IS_DOCUMENT({ 'a' : 0 }));
assertTrue(aql.AQL_IS_DOCUMENT({ 'a' : 1 }));
@ -324,7 +369,7 @@ function ahuacatlOperatorsTestSuite () {
/// @brief test aql.IS_DOCUMENT function
////////////////////////////////////////////////////////////////////////////////
testIsObjectFalse : function () {
testIsDocumentFalse : function () {
assertFalse(aql.AQL_IS_DOCUMENT('abc'));
assertFalse(aql.AQL_IS_DOCUMENT('null'));
assertFalse(aql.AQL_IS_DOCUMENT('false'));
@ -353,6 +398,52 @@ function ahuacatlOperatorsTestSuite () {
assertFalse(aql.AQL_IS_DOCUMENT([ false ]));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.IS_OBJECT function
////////////////////////////////////////////////////////////////////////////////
testIsObjectTrue : function () {
assertTrue(aql.AQL_IS_OBJECT({ }));
assertTrue(aql.AQL_IS_OBJECT({ 'a' : 0 }));
assertTrue(aql.AQL_IS_OBJECT({ 'a' : 1 }));
assertTrue(aql.AQL_IS_OBJECT({ 'a' : 0, 'b' : 1 }));
assertTrue(aql.AQL_IS_OBJECT({ '1' : false, 'b' : false }));
assertTrue(aql.AQL_IS_OBJECT({ '0' : false }));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.IS_OBJECT function
////////////////////////////////////////////////////////////////////////////////
testIsObjectFalse : function () {
assertFalse(aql.AQL_IS_OBJECT('abc'));
assertFalse(aql.AQL_IS_OBJECT('null'));
assertFalse(aql.AQL_IS_OBJECT('false'));
assertFalse(aql.AQL_IS_OBJECT('undefined'));
assertFalse(aql.AQL_IS_OBJECT(''));
assertFalse(aql.AQL_IS_OBJECT(' '));
assertFalse(aql.AQL_IS_OBJECT(false));
assertFalse(aql.AQL_IS_OBJECT(true));
assertFalse(aql.AQL_IS_OBJECT(undefined));
assertFalse(aql.AQL_IS_OBJECT(NaN));
assertFalse(aql.AQL_IS_OBJECT(1.3e308 * 1.3e308));
assertFalse(aql.AQL_IS_OBJECT(0));
assertFalse(aql.AQL_IS_OBJECT(1));
assertFalse(aql.AQL_IS_OBJECT(-1));
assertFalse(aql.AQL_IS_OBJECT(0.1));
assertFalse(aql.AQL_IS_OBJECT(-0.1));
assertFalse(aql.AQL_IS_OBJECT(null));
assertFalse(aql.AQL_IS_OBJECT([ ]));
assertFalse(aql.AQL_IS_OBJECT([ 0 ]));
assertFalse(aql.AQL_IS_OBJECT([ 0, 1 ]));
assertFalse(aql.AQL_IS_OBJECT([ 1, 2 ]));
assertFalse(aql.AQL_IS_OBJECT([ '' ]));
assertFalse(aql.AQL_IS_OBJECT([ '0' ]));
assertFalse(aql.AQL_IS_OBJECT([ '1' ]));
assertFalse(aql.AQL_IS_OBJECT([ true ]));
assertFalse(aql.AQL_IS_OBJECT([ false ]));
},
////////////////////////////////////////////////////////////////////////////////
/// @brief test aql.TO_BOOL function
////////////////////////////////////////////////////////////////////////////////

View File

@ -208,7 +208,7 @@ ERROR_QUERY_BIND_PARAMETER_TYPE,1553,"bind parameter '%s' has an invalid value o
ERROR_QUERY_INVALID_LOGICAL_VALUE,1560,"invalid logical value","Will be raised when a non-boolean value is used in a logical operation."
ERROR_QUERY_INVALID_ARITHMETIC_VALUE,1561,"invalid arithmetic value","Will be raised when a non-numeric value is used in an arithmetic operation."
ERROR_QUERY_DIVISION_BY_ZERO,1562,"division by zero","Will be raised when there is an attempt to divide by zero."
ERROR_QUERY_LIST_EXPECTED,1563,"list expected","Will be raised when a non-list operand is used for an operation that expects a list argument operand."
ERROR_QUERY_ARRAY_EXPECTED,1563,"array expected","Will be raised when a non-array operand is used for an operation that expects an array argument operand."
ERROR_QUERY_FAIL_CALLED,1569,"FAIL(%s) called","Will be raised when the function FAIL() is called from inside a query."
ERROR_QUERY_GEO_INDEX_MISSING,1570,"no suitable geo index found for geo restriction on '%s'","Will be raised when a geo restriction was specified but no suitable geo index is found to resolve it."
ERROR_QUERY_FULLTEXT_INDEX_MISSING,1571,"no suitable fulltext index found for fulltext query on '%s'","Will be raised when a fulltext query is performed on a collection without a suitable fulltext index."

View File

@ -163,7 +163,7 @@ void TRI_InitialiseErrorMessages () {
REG_ERROR(ERROR_QUERY_INVALID_LOGICAL_VALUE, "invalid logical value");
REG_ERROR(ERROR_QUERY_INVALID_ARITHMETIC_VALUE, "invalid arithmetic value");
REG_ERROR(ERROR_QUERY_DIVISION_BY_ZERO, "division by zero");
REG_ERROR(ERROR_QUERY_LIST_EXPECTED, "list expected");
REG_ERROR(ERROR_QUERY_ARRAY_EXPECTED, "array expected");
REG_ERROR(ERROR_QUERY_FAIL_CALLED, "FAIL(%s) called");
REG_ERROR(ERROR_QUERY_GEO_INDEX_MISSING, "no suitable geo index found for geo restriction on '%s'");
REG_ERROR(ERROR_QUERY_FULLTEXT_INDEX_MISSING, "no suitable fulltext index found for fulltext query on '%s'");

View File

@ -399,9 +399,9 @@
/// operation.
/// - 1562: @LIT{division by zero}
/// Will be raised when there is an attempt to divide by zero.
/// - 1563: @LIT{list expected}
/// Will be raised when a non-list operand is used for an operation that
/// expects a list argument operand.
/// - 1563: @LIT{array expected}
/// Will be raised when a non-array operand is used for an operation that
/// expects an array argument operand.
/// - 1569: @LIT{FAIL(\%s) called}
/// Will be raised when the function FAIL() is called from inside a query.
/// - 1570: @LIT{no suitable geo index found for geo restriction on '\%s'}
@ -2248,15 +2248,15 @@ void TRI_InitialiseErrorMessages ();
#define TRI_ERROR_QUERY_DIVISION_BY_ZERO (1562)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1563: ERROR_QUERY_LIST_EXPECTED
/// @brief 1563: ERROR_QUERY_ARRAY_EXPECTED
///
/// list expected
/// array expected
///
/// Will be raised when a non-list operand is used for an operation that
/// expects a list argument operand.
/// Will be raised when a non-array operand is used for an operation that
/// expects an array argument operand.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_QUERY_LIST_EXPECTED (1563)
#define TRI_ERROR_QUERY_ARRAY_EXPECTED (1563)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1569: ERROR_QUERY_FAIL_CALLED