Hi,

This is what's happening :

Your query works the first time you run it but fails subsequent times you run 
it.

This is because you need to use dls:document-insert-and-manage() on your first 
insertion and dls:document-checkout-update-checking() or a series of equivalent 
functions on subsequent uses.

This should probably do the trick:

let $contents :={'key':'value'}
return  xdmp:invoke-function(
      function() {
if(dls:document-is-managed("/test/test001.json")) then
  dls:document-checkout-update-checkin("/test/test001.json", 
$contents,(),fn:true())
else
(
dls:document-insert-and-manage("/test/test001.json", 
fn:true(),$contents,(),(),"TEST-COLLECTION"), xdmp:commit() )
},<options xmlns="xdmp:eval">
        <transaction-mode>update</transaction-mode>
      </options>);


Best,
Rob

Rob Szkutak
Senior Consultant
MarkLogic Corporation
[email protected]
www.marklogic.com<http://www.marklogic.com>

________________________________
From: [email protected] 
[[email protected]] on behalf of Shiv Shankar 
[[email protected]]
Sent: Wednesday, September 21, 2016 10:16 AM
To: [email protected]
Subject: [MarkLogic Dev General] Error :XDMP-CONFLICTINGUPDATES

Hi Rob,


I was just constructing the $contents . Any thoughts?

let $contents :={'key':'value'}
return  xdmp:invoke-function(
      function() {dls:document-insert-and-manage("/test/test001.json", 
fn:true(),$contents,(),(),"TEST-COLLECTION"), xdmp:commit() },<options 
xmlns="xdmp:eval">
        <transaction-mode>update</transaction-mode>
      </options>);

_______________________________________________
General mailing list
[email protected]
Manage your subscription at: 
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to