[MarkLogic Dev General] How to display updated document right after update query

Sudheer Yalaverthi sudheer.yalaverthi at db.com
Fri Mar 27 09:02:38 PDT 2015


Classification: Public
Hi Danny,


You can end the transaction with semi colon. Then in the same x-query, access the document and return it.

For ex.

(: This is the first transaction where update happens:)
declare variable $uri as xs:string := "/doc/sample.xml";
let $doc := fn:doc($uri)
return xdmp:node-replace($doc/update-node, element new-node { "new text"})
;

(:This is the second transaction where you can read the changes from first transaction :)
(: Variables, imports, namespaces must be defined again here.:)

declare variable $uri as xs:string := "/doc/sample.xml";

fn:doc($uri)




From: general-bounces at developer.marklogic.com [mailto:general-bounces at developer.marklogic.com] On Behalf Of Danny Sinang
Sent: Friday, March 27, 2015 11:54 AM
To: general
Subject: [MarkLogic Dev General] How to display updated document right after update query

I've an update query that replaces a node within a document.

The node replacement works, but the requirement is for the same query to return the contents of the updated document.

I know this isn't normally possible since the update query doesn't do a commit till after the query is executed.

Anybody know of a workaround for this ?

Regards,
Danny



---
This communication may contain confidential and/or privileged information. If you are not the intended recipient (or have received this communication in error) please notify the sender immediately and destroy this communication. Any unauthorized copying, disclosure or distribution of the material in this communication is strictly forbidden.

Deutsche Bank does not render legal or tax advice, and the information contained in this communication should not be regarded as such.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20150327/43d83a24/attachment.html 


More information about the General mailing list