Hi Daniel,

- when executing it like this, inside of a closure, nothing happens. No modifications of the database and no errors (%updating missing) either - which is weird. Is this construct supported in 7.5?

I'm not exactly sure about this one - can somebody else help me out here? 

 - when I remove the sec:secure call and leave only the rest (adding %updating to the declaration) the second insert runs but the first one doesn't - the node is saved without a "id" attribute. Does this have something to do with the PUL order? (http://docs.basex.org/wiki/Update#Example)

Exactly - the example in the documentation explains it all. With the XQUF it is not at all possible to access
the changes you introduced in a query within the same query. If you want to do this you could use the
[transform expression], which modifies a copy of a given node. Like this:

 let $profile := 
             copy $p := json:parse-ml(convert:binary-to-string($data))
             modify insert node attribute id { sec:get-current-user-id() } into $p
             return $p
return (
  insert node $profile as last into db:open("db")/s:root
)

Hope this helps a little ...

Cheers,
Lukas


[transform expression] http://docs.basex.org/wiki/Update#transform