{"action":"opened","issue":{"url":"https://api.github.com/repos/arangodb/arangodb/issues/1792","repository_url":"https://api.github.com/repos/arangodb/arangodb","labels_url":"https://api.github.com/repos/arangodb/arangodb/issues/1792/labels{/name}","comments_url":"https://api.github.com/repos/arangodb/arangodb/issues/1792/comments","events_url":"https://api.github.com/repos/arangodb/arangodb/issues/1792/events","html_url":"https://github.com/arangodb/arangodb/issues/1792","id":144267628,"number":1792,"title":"Add possibility to reference original document in single document update statements","user":{"login":"dothebart","id":5013077,"avatar_url":"https://avatars.githubusercontent.com/u/5013077?v=3","gravatar_id":"","url":"https://api.github.com/users/dothebart","html_url":"https://github.com/dothebart","followers_url":"https://api.github.com/users/dothebart/followers","following_url":"https://api.github.com/users/dothebart/following{/other_user}","gists_url":"https://api.github.com/users/dothebart/gists{/gist_id}","starred_url":"https://api.github.com/users/dothebart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dothebart/subscriptions","organizations_url":"https://api.github.com/users/dothebart/orgs","repos_url":"https://api.github.com/users/dothebart/repos","events_url":"https://api.github.com/users/dothebart/events{/privacy}","received_events_url":"https://api.github.com/users/dothebart/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-03-29T13:38:10Z","updated_at":"2016-03-29T13:38:10Z","closed_at":null,"body":"`UPDATE` has the possibility to directly work with a single document:\r\n\r\n    'UPDATE \"dave\" WITH { friends: []) } IN persons'\r\n\r\nHowever, while one may use the variable emitted by a surrounding for loop:\r\n\r\n    FOR user IN users\r\n      FILTER user._key == \"7\"\r\n      UPDATE user WITH { friends: PUSH(user.friends, \"8\") } IN users\r\n\r\n `OLD` may only be used in the `RETURN` statement:\r\n\r\n    'UPDATE \"dave\" WITH { friends: PUSH(DOCUMENT(\"persons/dave\").friends, 8) } IN persons'\r\n\r\nshould be expressable like this:\r\n\r\n    'UPDATE \"dave\" WITH { friends: PUSH(OLD.friends, 8) } IN persons'"}}