# Is there a way to query old versions of a document?

**URL:** <https://community.bloomreach.com/t/is-there-a-way-to-query-old-versions-of-a-document/783>\
**Category:** Experience Manager (PaaS/OnPrem)\
**Created:** [February 1, 2019, 4:45pm UTC](https://community.bloomreach.com/t/is-there-a-way-to-query-old-versions-of-a-document/783 "2019-02-01T16:45:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![itGumby](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/itgumby/32/1326_2.png) [@itGumby](https://community.bloomreach.com/u/itGumby)\
**Post date:** [February 1, 2019, 4:45pm UTC](https://community.bloomreach.com/t/is-there-a-way-to-query-old-versions-of-a-document/783/1 "2019-02-01T16:45:49Z")

</div>

Authors are claiming that the value of a field in a document has changed over time. I can’t find evidence of it. I am using the GUI to look a revision history, but that is slow (and error prone) when the authors have created 10 or more revisions in the last hour or 2.

Ideally, I would like to look at a specific property of all the revisions of a document - either in the query manager or in the console.

**How can I do that?**

---

<div class="post-metadata">

**Author:** ![ard.schrijvers](https://yyz1.discourse-cdn.com/flex027/user_avatar/community.bloomreach.com/ard.schrijvers/32/309_2.png) [@ard.schrijvers](https://community.bloomreach.com/u/ard.schrijvers)\
**Post date:** [February 2, 2019, 8:36pm UTC](https://community.bloomreach.com/t/is-there-a-way-to-query-old-versions-of-a-document/783/2 "2019-02-02T20:36:22Z")

</div>

> itGumby  
> February 1
> 
> Authors are claiming that the value of a field in a document has changed over time. I can’t find evidence of it. I am using the GUI to look a revision history, but that is slow (and error prone) when the authors have created 10 or more revisions in the last hour or 2.
> 
> Ideally, I would like to look at a specific property of all the revisions of a document - either in the query manager or in the console.

You’d only be able to do this programmatically…otherwise you have to  
go through the revision history in the cms or in the console. You  
could write a groovy script for it if you want to do it  
programmatically without redeploy

Regards Ard

---

<div class="post-metadata">

**Author:** ![woonsanko](https://avatars.discourse-cdn.com/v4/letter/w/b5a626/32.png) [@woonsanko](https://community.bloomreach.com/u/woonsanko)\
**Post date:** [February 3, 2019, 12:14pm UTC](https://community.bloomreach.com/t/is-there-a-way-to-query-old-versions-of-a-document/783/3 "2019-02-03T12:14:22Z")

</div>

> [@itGumby](#):
>
> Authors are claiming that the value of a field in a document has changed over time. I can’t find evidence of it. I am using the GUI to look a revision history, but that is slow (and error prone) when the authors have created 10 or more revisions in the last hour or 2.
> 
> Ideally, I would like to look at a specific property of all the revisions of a document - either in the query manager or in the console.
> 
> **How can I do that?**

Suppose you have a “sample document”. Locate its “preview” document variant node (@hippostd:state=“unpublished”) because only the “preview” document variant node keeps JCR version history internally in our repository:

 ![how_to_see_revisions1](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/d1ebdec7d6607d60fd0895cf9da34a4c8c8669c7.png)  
You will see `@jcr:versionHistory` reference, which points to the version history folder node for that specific “preview” document preview variant node. Also, `@jcr:baseVersion` tells you that the current preview variant node is based on that specific revision node.

Click on the link of the `@jcr:versionHistory`, and you will see all the revisions underneath:

 ![how_to_see_revisions2](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/4c1c0e10d3d520ed176a02b41e8a20b42a328b65.png)  
Now, it’s intuitive enough. You see v1.3, v1.2, v1.1 and v1.0 there.

If you select the latest revision (v1.3) and its child node called `jcr:frozenNode`, you will see the real content of the document at the specific revision, which was _frozen_ safely:

 ![how_to_see_revisions3](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/0f46e5d51974e71e87b227c090334632ea3ace7e.png)  
You will see the _frozen_ node containing the current title property: “Lorem123”.

Now, if you investigate the revision v1.2, you will see the old title property: “Lorem12”:

 ![how_to_see_revisions4](https://canada1.discourse-cdn.com/flex027/uploads/bloomreach1/original/1X/7b55d96616cde75069fb80050864a7b8d4e5a088.png)

That’s how revisions are maintained for a document in brXM JCR repository.  
If you need to do it programmatically, you might want to either use or refer to HST Content Version Utils forge library [1].

Regards,

Woonsan

[1] [HST Content Version Utils – HST Content Version Utils](https://bloomreach-forge.github.io/hst-content-version-utils/)
