Hi Pradeep,

No, MarkLogic Server works with automatic commit and rollback, at the end of 
each 'update statement' (HTTP request that performs database changes).

The hard way is to perform the collection stuff with xdmp:eval statements, 
opening different transactions for each of them.
The easy way is to read all collections of a doc first, remove the redundant 
and just use plain Xquery to return the intersect of the old - removed ones:

let $org-collections := (1,2,3,4)
let $removed-collections := (2,4)
return
$org-collections[fn:not(. = $removed-collections)]

(also works with strings)

Kind regards,
Geert

>


drs. G.P.H. (Geert) Josten
Consultant


Daidalos BV
Hoekeindsehof 1-4
2665 JZ Bleiswijk

T +31 (0)10 850 1200
F +31 (0)10 850 1199

mailto:[email protected]
http://www.daidalos.nl/

KvK 27164984

P Please consider the environment before printing this mail.
De informatie - verzonden in of met dit e-mailbericht - is afkomstig van 
Daidalos BV en is uitsluitend bestemd voor de geadresseerde. Indien u dit 
bericht onbedoeld hebt ontvangen, verzoeken wij u het te verwijderen. Aan dit 
bericht kunnen geen rechten worden ontleend.

> From: [email protected]
> [mailto:[email protected]] On Behalf Of
> Pradeep Maddireddy
> Sent: woensdag 12 mei 2010 14:13
> To: General
> Subject: [MarkLogic Dev General] Commit in XQuery
>
> Hi..!
>
>  I need to write a XQuery function which would receive
> document URI, one or more collections as parameter  and we
> need to remove document from all the collections and then
> return all the collections to which the document still belongs.
>
> I am using xdmp:document-remove-collections to remove
> collections and then using xdmp:document-get-collections to
> retrieve the collections. Because the
> "xdmp:document-remove-collections" function changes are still
> to not commited, When I retrieve the collections it still
> list all the collections including the collections that were
> removed.  Do we have something like a commit in XQuery which
> could solve my problem.
>
> Thanks
> Pradeep Maddireddy
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to