xdmp.commit

xdmp.commit() as null

Summary

Commit the current transaction to the database.

Usage Notes

Transactions running in "update" or "query" transaction mode must be explicitly committed, using this function. xdmp:commit is a no-op in "auto" transaction mode (the default) because auto-commit transactions automatically commit at the end of every statement.

When you call xdmp:commit, the transaction is marked for commit, but commit does not actually happen until the end of the currently executing statement.

This function is equivalent to calling xdmp:transaction-commit for the current host and transaction: xdmp:transaction-commit(xdmp:host(), xdmp:transaction()).

See Also

Example

declareUpdate({explicitCommit: true});
xdmp.documentInsert("/docs/mydoc.json", {myData: "data"});
xdmp.commit();

  => 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.
Powered by MarkLogic Server | Terms of Use | Privacy Policy