Loading TOC...

MarkLogic 9 Product Documentation
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.

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.