Use Revert Revisions to revert the database to its state at a specified point in time.
Being able to restore the database to a previous state can simplify auditing,
enhance understanding of changes made over time,
and facilitate instant recovery without the need to search and retrieve a stored backup.
You can select whether to revert specific collections or revert all collections.
In this page:
The Document Revisions view
Document Revisions View
Document Revisions view
In the Studio, go to Settings > Document Revisions. From this view you can:
- The ability to revert documents to their past revisions depends on revisions being created.
- When no default configuration or collection-specific configurations are defined and enabled,
no revisions will be created for any document.
- Make sure that a configuration that suits your needs is defined.
Click to revert revisions. See more below.
Point in time
Set point in time
- Select or enter the point in time (LOCAL) to revert documents to.
The information text on the right will display the expected behavior in UTC.
When the revert process is executed:
Documents created AFTER the specified Point in Time will be moved to the Revision Bin.
Documents created BEFORE this time and that were modified after this time:
Any of these documents that own revisions will be reverted
to the revision created at the specified Point in Time or to the latest revision preceding this time.
When setting a limit on the number of revisions that are kept (by number or by age)
then only the most recent revisions are kept for the document.
If all of these revisions were created AFTER the Point in Time then the oldest revision will be
the one we revert to, even though that revision is newer than the specified time.
By doing so we make sure that all the documents that existed before the specified Point in Time
still exist after the revert process.
Documents created BEFORE this time that were Not modified after this Time are not reverted.
Revisions are ordered in the revisions storage by their change-vector, and Not by creation time.
When reverting the database (or selected collections) to some previous date,
RavenDB will iterate through the revisions, starting from the most recent revision,
and search for revisions that should be restored.
For each revision found - its matching document will be reverted to that revision.
To avoid conducting unnecessarily long searches or revert to revisions that are too old
RavenDB sets a limit to this search.
The search will stop once we hit a revision that was created prior to:
Point in Time - Time Window
The default Time Window value is 96 hours (4 days).
Point in Time to revert to:
Documents will be reverted to their latest revision that was created prior to this Point in Time.
We will stop searching the revisions once we hit a revision with creation time prior to:
- The list below contains revisions of all documents, it is not just revisions of a single document.
- The revisions are Not ordered by creation time, the order is set by their change-vector.
||14.2.2023 01:00||=> Document Users/3 stays with this revision content|
||17.2.2023 01:00||=> Document Users/4 will be moved to Revisions Bin|
||13.2.2023 01:00||=> Document Users/1 will be reverted to this revision|
||11.2.2023 01:00||=> Document Users/5 will be reverted to this revision +
STOP the search for more Users/5 revisions
||10.2.2023 01:00||=> Document Users/9 will Not be reverted to this revision +
STOP the search in this list
|. . .|
We iterate on the revisions starting from
Users/1revision created on
We search for a relevant revision for document
Users/1by iterating on all
The revision that will be restored for
Users/1is the one from
13.2.2023 01:00(line 6)
since it is the latest one prior to
Next, we search for a relevant revision for document
Users/5by iterating on all
and we reach line 7.
Here the search for
Users/5revisions will STOP since this revision was created prior to
We will revert the document to this revision since it is the latest one prior to
The following revision for
11.2.2023 03:00(line 8) is Not restored.
Users/3is Not modified, since it wasn't modified after
Users/4has NO revisions prior to
which means it was created AFTER this Point in Time,
so this document is moved to the Revisions Bin.
Next, we reach
Users/9revision created on
10.2.2023 01:00, which is PRIOR to
The search on this list will now STOP.
No further revisions will be taken into account, not even
Users/6revision created on
When reverting a document to one of its revisions, RavenDB actually creates a new revision for the document.
The content of this new revision is a copy of the historical revision content, and it becomes the current version of the document.
Database items other than documents, such as ongoing tasks, indexes, and compare-exchange,
are Not reverted by this process.
- Time series
Time series data is Not reverted. Learn more here.
When a document is reverted to a revision that owns attachments,
the attachments are restored to their state when the revision was created.
When a document is reverted to a revision that owns counters,
the counters are restored to functionality along with their values from that revision.
- Time series