Loading TOC...


   value as String
) as null


Set the transaction mode for the current session. Calling this function has no effect on existing transactions.

value The new transaction mode. Must be one of "auto", "query", "update", "query-single-statement", "update-auto-commit", and "multi-auto".

Usage Notes

Transaction mode determines what type of transaction MarkLogic creates during a session. The transaction type is fixed when the transaction is created, so calling xdmp.setTransactionMode never affects the current transaction.

The transaction mode defaults to "auto". To change the mode, you may call xdmp.setTransactionMode

Use xdmp.setTransactionMode to set the mode during execution.

For more details, see Understanding Transactions in MarkLogic Server in the Application Developer's Guide.

See Also


//  this transaction runs in update mode, due to the declaration
xdmp.eval('declareUpdate({explicitCommit: true}); \n\
xdmp.setTransactionMode("query"); \n\
xdmp.documentInsert("/docs/mydoc.json", {"myData": "data"}); \n\

// but this new transaction runs in query mode 
xdmp.eval('var res = []; \n\
res.push(xdmp.getTransactionMode()); \n\
res.push(cts.doc("/docs/mydoc.json")); \n\

=> ["query",{"myData":"data"}]

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