Display documents having several versions
Last modified by Manuel Leduc on 2026/06/02 17:54
| Displays documents which have more than one version |
| Type | Snippet |
| Category | |
| Developed by | |
| Rating | |
| License | GNU 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
#endA 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