<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.rollback.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.rollback</api:function-name><api:suggest>xdmp.rollback</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>rollback</api:suggest><api:function-link mode="xquery" fullname="xdmp:rollback">/apidoc/8.0/xdmp:rollback.xml</api:function-link><api:function mode="javascript" name="rollback" type="builtin" lib="xdmp" category="TransactionBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.rollback"><api:summary>
  Roll back the current transaction.
</api:summary><api:params/><api:return>null</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">
     When a transaction is rolled back, the current statement immediately
     terminates, updates made by any statement in the transaction are
     discarded, and the transaction terminates.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     Transactions running in "update" or "query" transaction mode should be
     explicitly rolled back, using this function. Failure to explicitly
     commit or roll back such a transaction leaves the transaction open
     until transaction timeout, thus unnecessarily holding resources and
     locks, potentially blocking other transactions.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     Transactions running in "auto" transaction mode may also use this
     function, to roll back a transaction without raising an error.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     The result of a statement terminated with <code>xdmp:rollback</code>
     is always the empty sequence.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     This function is equivalent to calling
     <code><a href="./xdmp:transaction-rollback">xdmp:transaction-rollback</a></code>
     for the current host and transaction:
     <code>xdmp:transaction-rollback(xdmp:host(), xdmp:transaction())</code>.
  </p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
// multi-statement transaction 
declareUpdate({explicitCommit: true});

xdmp.documentInsert("/docs/first.json", {"first": 1});
xdmp.documentInsert("/docs/second.json", {"second": 2});
xdmp.rollback();

  =&gt; Empty. The transaction is rolled back. The documents are
     not added to the database. The transaction ends.
</pre></api:example></api:function></api:function-page>