0

I want to manually update a managed document without incrementing to a new version.

I noticed that updating the document referenced by the uri doesn't propagate to the document pointed to by the latest version - I need to make another update directly in the latest version.

Are there any bad consequences of this hack or something that I missed?

let $uri := "/docs/doc.xml"

let $doc := fn:doc($uri)/doc
let $_ := xdmp:node-replace($doc/element/text(), text { "changed" })

let $hist := dls:document-history($uri)
let $docFromHist := dls:document-version($uri, max(data($hist//dls:version-id)))/doc
let $_ := xdmp:node-replace($docFromHist/element/text(), text { "changed" })
elmozgo
  • 3
  • 1

1 Answers1

0

According to the documentation you cannot use node update functions on documents under library services management:

https://docs.marklogic.com/guide/app-dev/dls#id_87706

You cannot use node update functions, such as xdmp:node-replace, with managed documents.

Instead you need to run the appropriate function from the dls library, which in this case would be dls:document-update()

Tamas
  • 10,953
  • 13
  • 47
  • 77