[MarkLogic Dev General] xdmp:collection-delete()

John Zhong john at yuxipacific.com
Thu Mar 8 01:38:27 PST 2012


I can reproduce your problem, I use ML 4.2-7 version.

I cannot set a folder into a collection via
xdmp:document-set-collections("/A/", "Test"), but I can use

xdmp:document-set-collections(cts:uri-match("/A/*")[1], "Test"), where
cts:uri-match("/A/*")[1] returns /A/

Then I executed xdmp:collection-delete("Test"), all the documents in the
folder /A/ were deleted even I didnot add them into collection "Test"...

John

On Thu, Mar 8, 2012 at 5:10 AM, Palani TT <palanitt at gmail.com> wrote:

> Hi Geert,
>
> Yes, I did verify the count of the the collection "Test" using
> count(fn:collection("Test")) and it was 50.
>
> Below is the code that I was using to move the doc uris to "Test"
> collection,
>
> let $result := for $i in cts:uri-match("/localhost/userid/*")[1 to 51]
>              let $insert-collections:= xdmp:document-set-collections($i,
> "Test")
>               return $insert-collections
>
> return "success"
>
> Since, I used the cts:uri-match(), the first doc uri that gets set in the
> "Test" collection will be "/localhost/userid/" and this was the reason for
> deletion of all the records under that folder when I tried to do
> xdmp:collection-delete().
>
> Thanks for extending your help!
>
> Regards,
> Palani
>
>
>
> Thanks,
> Palani
>
> On Wed, Mar 7, 2012 at 3:14 PM, Geert Josten <geert.josten at dayon.nl>wrote:
>
>> Hi Palani,
>>
>>
>>
>> Sure only 50 docs had been added to that collection? You can test that
>> easily using count(collection(“Test”)), or for a bit more speed
>> xdmp:estimate(collection(“Test”))
>>
>>
>>
>> Kind regards,
>>
>> Geert
>>
>>
>>
>> *Van:* general-bounces at developer.marklogic.com [mailto:
>> general-bounces at developer.marklogic.com] *Namens *Palani TT
>> *Verzonden:* woensdag 7 maart 2012 20:10
>> *Aan:* general at developer.marklogic.com
>> *Onderwerp:* [MarkLogic Dev General] xdmp:collection-delete()
>>
>>
>>
>> Hi,
>>
>>
>>
>> I am trying to understand the behavior of this function. My requirement
>> was to delete the records in a particular collection. I had like 2000
>> records under a particular userid/folder. I moved 50 records from that
>> userid to a collection named "Test" using xdmp:document-set-collections()
>> function. After that, I wanted to delete the collection "Test" by invoking
>> the function xdmp:collection:delete(). What happened was all the 2000
>> records under that particular userid/folder got deleted when I thought only
>> the 50 records were supposed to get deleted. Can anyone please, explain
>> this behavior?
>>
>>
>>
>> Thanks,
>>
>> Palani
>>
>> _______________________________________________
>> General mailing list
>> General at developer.marklogic.com
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> _______________________________________________
> General mailing list
> General at developer.marklogic.com
> http://developer.marklogic.com/mailman/listinfo/general
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://developer.marklogic.com/pipermail/general/attachments/20120308/392249a1/attachment-0001.html 


More information about the General mailing list