I have a corb script to run node replace on the xml files.
If I don't specify the collection, will it remove the documents from the existing collections?
If you are altering the document with xdmp:node-replace()
, then the document will remain in it's collections and you do not need to worry about setting/adding it back.
If you are using xdmp:document-insert()
to replace the document at the current URI, then you do need to specify the collection(s), otherwise it will be removed from the existing collections.
However, you can use xdmp:document-get-collections()
to retrieve the sequence of collections for the URI and use it for the 4th parameter of xdmp:document-insert()
xdmp:document-insert($URI, $doc, (), xdmp:document-get-collections($URI))