Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9050079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:33:55+00:00 2026-06-16T12:33:55+00:00

We have some business requirements that call for versioning. We chose to use MarkLogic

  • 0

We have some business requirements that call for versioning. We chose to use MarkLogic library services for that. We have an issue testing our code with XRAY and using transactions.

Our test is as follows:

declare function should-save-with-version-when-releasing() {
declare option xdmp:transaction-mode "update";

    let $uri := '/some-document-uri.xml'         
    let $document := fn:doc($uri) 
    let $pre-release-version := c:get-latest-version($uri)
    let $post-release-version := c:get-latest-version($uri)
    let $result := mut:release($document) (:this should version up:)

    return (assert:not-empty($pre-release-version), 
            assert:not-empty($result), 
            assert:not-equal($pre-release-version,$post-release-version),
            xdmp:rollback())

The test will pass no matter what, and as it turns out ML rollback demolishes all the variables.

How do we test it using transactions?

Any helps greatly appreciated,

im

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:33:56+00:00Added an answer on June 16, 2026 at 12:33 pm

    With MarkLogic an entire XQuery update normally acts like a single transaction. When mut:release adds an update to the transaction’s stack, the rest of the query will not see that update until after it commits. From the point of view of the query, this normally happens after the entire query finishes, and is not visible to the query.

    The docs have something useful to add about what http://docs.marklogic.com/xdmp:rollback does:

    When a transaction is rolled back, the current statement immediately
    terminates, updates made by any statement in the transaction are
    discarded, and the transaction terminates.

    So it isn’t that the variables are demolished: it’s that your program is over.

    I think http://docs.marklogic.com/guide/app-dev/transactions#id_15746 has an example that is fairly close to your use-case: “Example: Multi-statement Transactions and Same-statement Isolation”. It demonstrates how to xdmp:eval or xdmp:invoke to update a document and see the results within the same query.

    Test it to see that it works, then replace the xdmp:commit with an xdmp:rollback. For me the example still works. Start replacing the rest of the logic with your unit test logic, and you should be on your way.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have a business requirement that some users be automatically logged out of our
I have a library that I created with some business logic that includes writing
I have some business requirements which sound something like this: Find the data in
I am creating a series of UserControls that all have some similar business logic.
I have a servlet that does some business login and then redirects to a
I have a service object that is responsible for some business logic validation. What
Let's say you have a business logic method that can perform some operation across
I have a requirement to use business objects to call strongly typed table adapters
We are a team of developers that because of business requirements have to develop
I have problem deciding on which NoSql architecture stick to. Our business use case

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.