[MarkLogic Dev General] Query on commit in MarkLogic 5.0

Vedavalli Radhika radhika.kv at gmail.com
Wed Jun 13 05:01:26 PDT 2012


Hi,
Query on commit in ML 5.0.
I wanted to achieve updating an xml within a same transaction. I came
across xdmp:commit in ML5.0 and thought that this will solve our
issue.
But I was getting the below error when I executed this script.
Am I missing anything here?

let $transaction1 := (xdmp:set-transaction-mode("update"),
                    xdmp:document-insert("/example.xml",  <a><b>bbb</b></a>),
                    xdmp:commit())

let $transaction2 := (xdmp:set-transaction-mode("update"),
                    xdmp:node-replace(doc("/example.xml")/a/b, <c>ccc</c>),
                    xdmp:commit())
                    return "document updated"

Message thrown: [1.0-ml] XDMP-CONFLICTINGUPDATES:
xdmp:node-replace(fn:doc("/example.xml")/a/b, <c>ccc</c>) --
Conflicting updates xdmp:node-replace(fn:doc("/example.xml")/a/b,
<c>ccc</c>) and xdmp:document-insert("/example.xml",
<a><b>bbb</b></a>, (), (), 0)

Thanks,
Radhika.


More information about the General mailing list