mirror of https://gitee.com/bigwinds/arangodb
27 lines
1.6 KiB
JSON
27 lines
1.6 KiB
JSON
[
|
|
{
|
|
"name" : "FOR .. FILTER .. RETURN template",
|
|
"value": "/* Please insert some values for the @@collection and @value placeholders */\nFOR i IN @@collection\n FILTER i.`attribute` == @value\n RETURN i"
|
|
},
|
|
{
|
|
"name" : "Limit",
|
|
"value": "/* Please insert some values for the @@collection, @offset and @count placeholders */\nFOR i IN @@collection\n LIMIT @offset, @count\n RETURN i"
|
|
},
|
|
{
|
|
"name" : "Random document",
|
|
"value": "/* Please insert some value for the @@collection placeholder */\nFOR i IN @@collection\n SORT RAND()\n LIMIT 1\n RETURN i"
|
|
},
|
|
{
|
|
"name" : "Subquery example",
|
|
"value": "/* Please insert some values for the @@collection, @value and @count placeholders */\nFOR i IN @@collection\n LET values = (\n FOR s IN i.`attribute`\n FILTER s.`attribute` == @value\n RETURN s\n )\n FILTER LENGTH(values) > @count\n RETURN {\n i : i,\n values : values\n }"
|
|
},
|
|
{
|
|
"name" : "Sequences",
|
|
"value": "/* Returns the sequence of integers between 2010 and 2013 (including) */\nFOR year IN 2010..2013\n RETURN year"
|
|
},
|
|
{
|
|
"name" : "Bind parameters",
|
|
"value": "/* There are two types of bind parameters:\n - bind parameter names starting with a single @ character, e.g. @count, @value, @test:\n These can be used to ship any JSON-encodable data to the server.\n - bind parameter names starting with two @ characters always refer to collections, e.g. @@collections, @@c:\n These can be used as placeholders for collection names.\n */\nFOR i IN @collection\n FILTER i.value == @value\n RETURN i"
|
|
}
|
|
]
|