Marklogic: DLS-INVALIDVERSION

175 views Asked by At

when trying to access older versions of my managed XML files, it gives me something like:

DLS-INVALIDVERSION: (err:FOER0000) /company/1448220.xml has no version number 3
in /MarkLogic/dls.xqy, at 1403:6, ...

Indeed, the file of version 1, 2, 3 within /company/1448220_xml_versions does not exist (in this case lets assume version 4 is the most recent).

When updating a document using dls (Document Management) functions, I run the following tasks:

  1. Check whether the document is managed or not
  2. When its not managed, set to manage using dls:document-manage($uri, fn:false()) inside of an eval statement
  3. Update the document using dls:document-checkout-update-checkin($uri, $new-doc, "Document update", fn:true()) inside of an eval statement

So far so good.

When tying to get a specific version of a document:

  1. dls:document-version($document-uri, xs:unsignedInt($version))

==> When using $version := 4 it gives me a valid document (which in turn is the most recent version)

==> When using $version := 1 it just gives me an error, indicating that the document of version 1 doesn't exist.

What I am doing wrong?

I am using MarkLogic 6.

1

There are 1 answers

1
Jollymorphic On BEST ANSWER

You probably haven't set a retention policy using dls:retention-rule-insert, and the default retention rules retain nothing (which means that MarkLogic deletes all older versions of a given document each time you store a new version of it). See the "Defining a retention policy" section in the MarkLogic Application Developer's Guide, here.