MarkLogic Server 11.0 Product Documentation
xdmp.transaction

xdmp.transaction(
   [txn-name as String],
   [host-id as (Number|String)]
) as Sequence

Summary

Returns the transaction ID for the current transaction, or transaction IDs for all transactions with the given name.

Parameters
txn-name An optional transaction name.
host-id An optional host ID, for retrieving the transaction ID of a named remote transaction. Default: The current host (xdmp:host()).

Usage Notes

When called with no parameters, this function returns the transaction ID of the current transaction on the local host. When called with a txn-name, the transaction ID for the named local or remote transaction(s) is returned.

Transaction names need not be unique. This function will return multiple transaction IDs if more than one transaction matches the parameters.

To retrieve the transaction ID of a named remote transaction, supply a host-id. If host-id is unknown or MarkLogic Server is not online on that host, an exception is raised.

If no matching transaction exists, an empty sequence is returned.

See Also

Example

xdmp.transaction();
=> The transaction ID for the current transaction on the local host.

Example

xdmp.transaction("myNamedTransaction");
=> The transaction ID for "myNamedTransaction" on the local host.

Example

xdmp.transaction("myNamedTransaction",
       xdmp.host("some-host.marklogic.com"));
=> The transaction ID for "myNamedTransaction" on the remote host
   some-host.marklogic.com.
Powered by MarkLogic Server | Terms of Use | Privacy Policy