thichxai
thichxai

Reputation: 1137

Marklogic - How to rollback document

I am a newbie to marklogic. How do I rollback a document I deleted. I use the function xdmp:rollback() from https://docs.marklogic.com/xdmp:rollback. but I could not see a document restore back to database. Thanks in advance.

xdmp:document-delete("/data/edu/GMU.xml"),
xdmp:rollback()

Upvotes: 0

Views: 173

Answers (1)

hunterhacker
hunterhacker

Reputation: 7132

In your example code you never actually committed the document (because the full statement never concluded successfully) and so you don't need to do a rollback. You just need to prevent the statement from succeeding by, for example, generating an fn:error() to fail the entire statement and then all pending changes in the statement will never be committed.

Upvotes: 2

Related Questions