Display documents having several versions

Last modified by Manuel Leduc on 2026/06/02 17:54

cogDisplays documents which have more than one version
TypeSnippet
Category
Developed by

Oana Florea

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1

Table of contents

Description

The snippet displays all documents in the Sandbox space which have more than one version.

#set($hql = "select doc.fullName from XWikiDocument as doc, XWikiRCSNodeInfo as node where node.id.docId=doc.id and doc.space='Sandbox' group by doc.fullName having count(node.id.version1)>1")
#foreach($item in $xwiki.search($hql))
  * $item
#end

A similar snippet will display all documents from the Sandbox space and their version numbers: major version and minor version (see the xwiki database schema).

#set($hql = "select doc.fullName, node.id.version1, node.id.version2 from XWikiDocument as doc, XWikiRCSNodeInfo as node where node.id.docId=doc.id and doc.space='Sandbox'")
#foreach($item in $xwiki.search($hql))
  * $item.get(0) $item.get(1) $item.get(2)
#end

Get Connected