XQuery Update allows you to insert, delete, replace and rename nodes using built-in keywords (insert, delete, replace and rename, respectively). You can also perform a node update by declaring an update function.
XQuery Update does not perform updates (node insertion, deletion, and so forth) until after the query has completed. This means a couple of things. First, you cannot perform an update and return the results in the same query.
Also, update statements are order independent, although in some cases conflicting updates are performed in an order defined by the XQuery Update statement specification).
Finally, updates are generally expected to be performed in isolation from other queries. You cannot, for example, perform a search and then in a subsequent statement perform an update, all in the same query.
XQuery Update is described in the W3C specification, XQuery Update Facility 1.0. This specification is currently a working draft. BDB XML implements the version of the specification dated 28 August 2007.