8000 add example combining POSITION and the array expansion operator · larsborn/arangodb-docs@9726819 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9726819

Browse files
committed
add example combining POSITION and the array expansion operator
1 parent 4c9ce64 commit 9726819

File tree

5 files changed

+70
-0
lines changed

5 files changed

+70
-0
lines changed

3.10/aql/functions-array.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ Return whether *search* is contained in *array*. Optionally return the position.
547547
To determine if or at which position a string occurs in another string, see the
548548
[CONTAINS() string function](functions-string.html#contains).
549549

550+
If you want to search a list of objects,
551+
[the array expansion operator [*]](advanced-array-operators.html#array-expansion) might also be of
552+
interest. The third example below will illustrate its usage in this context.
553+
550554
**Examples**
551555

552556
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
@@ -567,6 +571,16 @@ RETURN POSITION( [2,4,6,8], 4, true )
567571
{% endaqlexample %}
568572
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
569573

574+
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
575+
@startDocuBlockInline aqlArrayPosition_3
576+
@EXAMPLE_AQL{aqlArrayPosition_3}
577+
LET arr = [{field_name: "foo"}, {field_name: "bar"}, {field_name: "baz"}, {field_name: "bay"}]
578+
RETURN POSITION(arr[*].field_name, "baz", true)
579+
@END_EXAMPLE_AQL
580+
@endDocuBlock aqlArrayPosition_3
581+
{% endaqlexample %}
582+
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
583+
570584
## PUSH()
571585

572586
`PUSH(anyArray, value, unique) → newArray`

3.11/aql/functions-array.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ Return whether *search* is contained in *array*. Optionally return the position.
547547
To determine if or at which position a string occurs in another string, see the
548548
[CONTAINS() string function](functions-string.html#contains).
549549

550+
If you want to search a list of objects,
551+
[the array expansion operator [*]](advanced-array-operators.html#array-expansion) might also be of
552+
interest. The third example below will illustrate its usage in this context.
553+
550554
**Examples**
551555

552556
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
@@ -567,6 +571,16 @@ RETURN POSITION( [2,4,6,8], 4, true )
567571
{% endaqlexample %}
568572
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
569573

574+
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
575+
@startDocuBlockInline aqlArrayPosition_3
576+
@EXAMPLE_AQL{aqlArrayPosition_3}
577+
LET arr = [{field_name: "foo"}, {field_name: "bar"}, {field_name: "baz"}, {field_name: "bay"}]
578+
RETURN POSITION(arr[*].field_name, "baz", true)
579+
@END_EXAMPLE_AQL
580+
@endDocuBlock aqlArrayPosition_3
581+
{% endaqlexample %}
582+
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
583+
570584
## PUSH()
571585

572586
`PUSH(anyArray, value, unique) → newArray`

3.7/aql/functions-array.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ Return whether *search* is contained in *array*. Optionally return the position.
547547
To determine if or at which position a string occurs in another string, see the
548548
[CONTAINS() string function](functions-string.html#contains).
549549

550+
If you want to search a list of objects,
551+
[the array expansion operator [*]](advanced-array-operators.html#array-expansion) might also be of
552+
interest. The third example below will illustrate its usage in this context.
553+
550554
**Examples**
551555

552556
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
@@ -567,6 +571,16 @@ RETURN POSITION( [2,4,6,8], 4, true )
567571
{% endaqlexample %}
568572
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
569573

574+
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
575+
@startDocuBlockInline aqlArrayPosition_3
576+
@EXAMPLE_AQL{aqlArrayPosition_3}
577+
LET arr = [{field_name: "foo"}, {field_name: "bar"}, {field_name: "baz"}, {field_name: "bay"}]
578+
RETURN POSITION(arr[*].field_name, "baz", true)
579+
@END_EXAMPLE_AQL
580+
@endDocuBlock aqlArrayPosition_3
581+
{% endaqlexample %}
582+
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
583+
570584
## PUSH()
571585

572586
`PUSH(anyArray, value, unique) → newArray`

3.8/aql/functions-array.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ Return whether *search* is contained in *array*. Optionally return the position.
547547
To determine if or at which position a string occurs in another string, see the
548548
[CONTAINS() string function](functions-string.html#contains).
549549

550+
If you want to search a list of objects,
551+
[the array expansion operator [*]](advanced-array-operators.html#array-expansion) might also be of
552+
interest. The third example below will illustrate its usage in this context.
553+
550554
**Examples**
551555

552556
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
@@ -567,6 +571,16 @@ RETURN POSITION( [2,4,6,8], 4, true )
567571
{% endaqlexample %}
568572
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
569573

574+
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
575+
@startDocuBlockInline aqlArrayPosition_3
576+
@EXAMPLE_AQL{aqlArrayPosition_3}
577+
LET arr = [{field_name: "foo"}, {field_name: "bar"}, {field_name: "baz"}, {field_name: "bay"}]
578+
RETURN POSITION(arr[*].field_name, "baz", true)
579+
@END_EXAMPLE_AQL
580+
@endDocuBlock aqlArrayPosition_3
581+
{% endaqlexample %}
582+
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
583+
570584
## PUSH()
571585

572586
`PUSH(anyArray, value, unique) → newArray`

3.9/aql/functions-array.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -547,6 +547,10 @@ Return whether *search* is contained in *array*. Optionally return the position.
547547
To determine if or at which position a string occurs in another string, see the
548548
[CONTAINS() string function](functions-string.html#contains).
549549

550+
If you want to search a list of objects,
551+
[the array expansion operator [*]](advanced-array-operators.html#array-expansion) might also be of
552+
interest. The third example below will illustrate its usage in this context.
553+
550554
**Examples**
551555

552556
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
@@ -567,6 +571,16 @@ RETURN POSITION( [2,4,6,8], 4, true )
567571
{% endaqlexample %}
568572
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
569573

574+
{% aqlexample examplevar="examplevar" type="type" query="query" bind="bind" result="result" %}
575+
@startDocuBlockInline aqlArrayPosition_3
576+
@EXAMPLE_AQL{aqlArrayPosition_3}
577+
LET arr = [{field_name: "foo"}, {field_name: "bar"}, {field_name: "baz"}, {field_name: "bay"}]
578+
RETURN POSITION(arr[*].field_name, "baz", true)
579+
@END_EXAMPLE_AQL
580+
@endDocuBlock aqlArrayPosition_3
581+
{% endaqlexample %}
582+
{% include aqlexample.html id=examplevar type=type query=query bind=bind result=result %}
583+
570584
## PUSH()
571585

572586
`PUSH(anyArray, value, unique) → newArray`

0 commit comments

Comments
 (0)
0