<?xml version="1.0" encoding="UTF-8"?><api:function-page xml:base="/apidoc/8.0/xdmp.commit.xml" generated="2015-10-07T16:36:00.016766-07:00" mode="javascript" xmlns:api="http://marklogic.com/rundmc/api"><api:function-name>xdmp.commit</api:function-name><api:suggest>xdmp.commit</api:suggest><api:suggest>xdmp</api:suggest><api:suggest>commit</api:suggest><api:function-link mode="xquery" fullname="xdmp:commit">/apidoc/8.0/xdmp:commit.xml</api:function-link><api:function mode="javascript" name="commit" type="builtin" lib="xdmp" category="TransactionBuiltins" hidden="false" bucket="MarkLogic Built-In Functions" prefix="xdmp" namespace="http://marklogic.com/xdmp" fullname="xdmp.commit"><api:summary>
  Commit the current transaction to the database.
</api:summary><api:params/><api:return>null</api:return><api:usage>
  <p xmlns="http://www.w3.org/1999/xhtml">
     Transactions running in "update" or "query" transaction mode must be
     explicitly committed, using this function. <code>xdmp:commit</code>
     is a no-op in "auto" transaction mode (the default) because
     auto-commit transactions automatically commit at the end of
     every statement.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     When you call <code>xdmp:commit</code>, the transaction is marked for
     commit, but commit does not actually happen until the end of the
     currently executing statement.
  </p>
  <p xmlns="http://www.w3.org/1999/xhtml">
     This function is equivalent to calling
     <code><a href="./xdmp:transaction-commit">xdmp:transaction-commit</a></code>
     for the current host and transaction:
     <code>xdmp:transaction-commit(xdmp:host(), xdmp:transaction())</code>.
  </p>
</api:usage><api:example class="javascript"><pre xml:space="preserve" xmlns="http://www.w3.org/1999/xhtml">
declareUpdate({explicitCommit: true});
xdmp.documentInsert("/docs/mydoc.json", {myData: "data"});
xdmp.commit();

  =&gt; Empty. The current transaction is marked ready to be committed.
     When the commit completes, the document is visible in the database,
     and the transaction ends.
</pre></api:example></api:function></api:function-page>