I am trying to delete a collection in MarkLogic via Query Console using the xdmp:collection-delete function but I am getting a timeout exception:
SVC-EXTIME: xdmp:collection-delete("") -- Time limit exceeded"
The collection contains about 150,000 documents and are small documents. Can someone help?
The time is set to 3600 in the admin console.I tried using the xdmp:spawn-function to delete it in batches,but i am getting a syntax error:
"unexpected Lbrace_, expecting Comma_ or Rpar_": xquery version "0.9-ml" define variable $uriMatch as xs:string {"/sortkey-257-2019*"} let $_ := for $uri in cts:uri-match($uriMatch) return if(doc-available($uri)) then (xdmp:spawn-function(function(){ xdmp:collection-delete(xdmp:document-get-collections($uri)),xdmp:commit()} , update )) else () return $_
PFB, the query that is returning XDMP:MAX-TASKS exception: xquery version "1.0-ml"; let $uriMatch:="/snapshot-257-2019*"
for $uri in cts:uri-match($uriMatch)
return
if(fn:doc-available($uri)) then
let $x:=
xdmp:spawn-function(function(){
xdmp:collection-delete(xdmp:document-get-collections($uri)),xdmp:commit()},
update
)
return $x
else
xdmp:log("No documents in collection")