mirror of https://gitee.com/bigwinds/arangodb
parent
159fefafe9
commit
56497e13f9
|
@ -164,13 +164,10 @@ FOR u IN users
|
|||
RETURN length
|
||||
```
|
||||
|
||||
The above is equivalent to, but more efficient than:
|
||||
The above is equivalent to, but less efficient than:
|
||||
|
||||
```
|
||||
RETURN LENGTH(
|
||||
FOR u IN users
|
||||
RETURN length
|
||||
)
|
||||
RETURN LENGTH(users)
|
||||
```
|
||||
|
||||
The *WITH COUNT* clause can also be used to efficiently count the number
|
||||
|
|
|
@ -98,7 +98,8 @@ documents. For each inserted document, the document key is returned:
|
|||
|
||||
```js
|
||||
FOR i IN 1..100
|
||||
INSERT { value: i }
|
||||
INSERT { value: i }
|
||||
IN users
|
||||
LET inserted = NEW
|
||||
RETURN inserted._key
|
||||
```
|
||||
|
|
|
@ -233,7 +233,8 @@ documents before modification. For each modified document, the document key is r
|
|||
|
||||
```js
|
||||
FOR u IN users
|
||||
UPDATE u WITH { value: "test" }
|
||||
UPDATE u WITH { value: "test" }
|
||||
IN users
|
||||
LET previous = OLD
|
||||
RETURN previous._key
|
||||
```
|
||||
|
@ -244,6 +245,7 @@ without some of the system attributes:
|
|||
```js
|
||||
FOR u IN users
|
||||
UPDATE u WITH { value: "test" }
|
||||
IN users
|
||||
LET updated = NEW
|
||||
RETURN UNSET(updated, "_key", "_id", "_rev")
|
||||
```
|
||||
|
@ -253,5 +255,6 @@ It is also possible to return both `OLD` and `NEW`:
|
|||
```js
|
||||
FOR u IN users
|
||||
UPDATE u WITH { value: "test" }
|
||||
IN users
|
||||
RETURN { before: OLD, after: NEW }
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue